CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2009
    Posts
    9

    embedding a 3rd party LIB in a DLL

    Hi there,

    I work on an application, say MyApp.exe.

    MyApp.exe links to MyDll.dll through its lib file.

    Both MyApp.exe and MyDll.dll rely on a third party static library, ThirdParty.lib.

    Is there a way I can embed ThirdParty.lib in MyDll.dll - an avoid having to specify both MyDll.lib and ThirdyParty.lib in the link dependencies of MyApp.exe. I would like to specify only MyDll.lib

    Thanks for any help.....

    Andy

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: embedding a 3rd party LIB in a DLL

    No. The functions in the static library are added to the exe/dll at link time. You could wrap the functions in your DLL. In other words, in your DLL export functions that you write, that just call the functions in the static library. Then, you exe only depends on your DLL.

    Viggy

  3. #3
    Join Date
    May 2009
    Posts
    9

    Re: embedding a 3rd party LIB in a DLL

    thanks Viggy, that's not very practical - but I guess there's no other way out

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: embedding a 3rd party LIB in a DLL

    Actually, another thought occured to me. You might be able to combine the libraries into one, using the lib - library manager tool. Though, I've never done this...

    Viggy

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: embedding a 3rd party LIB in a DLL

    Quote Originally Posted by andypandy2 View Post
    thanks Viggy, that's not very practical - but I guess there's no other way out
    Well, your guess is wrong. Here's the sample where you can see how to export function from dll while it's implementation resides in lib.
    Attached Files Attached Files
    Last edited by Igor Vartanov; June 2nd, 2009 at 03:21 PM.
    Best regards,
    Igor

  6. #6
    Join Date
    May 2009
    Posts
    9

    Re: embedding a 3rd party LIB in a DLL

    Oops... left the subject for dead. Thanks for the tip, I'll be looking into it Asap

  7. #7
    Join Date
    May 2009
    Posts
    9

    Re: embedding a 3rd party LIB in a DLL

    Igor,

    Does this mean I have to type out all the functions in the EXPORTS section of the DEF file ? Is there a "Export All functions" possibility ?

    Thanks again

    Andy

  8. #8
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: embedding a 3rd party LIB in a DLL

    Yes, it does mean.

    Besides, it may also hint you that all the functionality that uses the 3rd party lib should be moved to a single module (dll most likely), and all the other consumers would re-use that one.
    Best regards,
    Igor

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured