Thread: Including DLL's

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    193

    Including DLL's

    I was wondering if there was any way to include a .DLL file WITHOUT having to have the .DLL file in the same directory as the .EXE? Like, I want to have the .DLL inside of the .EXE so other users wont have to worry about having the .DLL on their computer to execute the .EXE. I hope I didnt confuse you. The LoadLibrary functions I found only work if the .DLL is in the same directory as the .EXE so please dont tell me how to load .DLLs with the LoadLibrary functions.

    Thanks for any help. It is much appreciated.

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Static linkage.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    193
    I'm sorry, but this is the first time I've heard of "static linkage". Would you mind explaining to me how I would include .DLL in a .EXE with this?

  4. #4
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    Quote Originally Posted by Tonto
    Static linkage.
    Now that's a good one. From what i recall DLL stands for Dynamic Link Library. I guess that says it all doesn't it? DLL's are supposed to be linked dynamically not statically. Usually for static linking the extension in windows is .lib

    Cheers

  5. #5
    Registered User
    Join Date
    Aug 2004
    Posts
    193
    How do I convert a .DLL to a .LIB and then how do I include a .LIB? The .DLL file is libmySQL.DLL. I'm sorry, but I'm not very experienced with C++.

    Thanks for the replies. Its appreciated.

  6. #6
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Have you tried to use the DLL with the import lib which is created from your compiling the DLL? You'll have to include your header file and import lib when you're linking all your objects. Finally, the DLL must be in the PATH or the same directory as the executable. This approach eliminates the need to use LoadLibrary.

  7. #7
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    How do I convert a .DLL to a .LIB and then how do I include a .LIB? The .DLL file is libmySQL.DLL.
    There's no way that i know of to convert a .DLL into a .LIB. Plus, is there any good reason for doing that? or are you just trying to hide the fact that you are using it?

  8. #8
    Registered User
    Join Date
    Aug 2004
    Posts
    193
    the DLL must be in the PATH or the same directory as the executable
    Thats what I'm trying to eliminate...

    I want to make a program where you only need a .EXE and nothing else. I dont want other people who use this program to have to hassel with the .DLL (hassel = keeping the .DLL in the same directory).

  9. #9
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    I want to make a program where you only need a .EXE and nothing else. I dont want other people who use this program to have to hassel with the .DLL (hassel = keeping the .DLL in the same directory).
    Hmmm, that's no hassle, you will have to distribute the application won't you? Simply distribute the .DLL with it. Don't take me wrong but to me it just looks like you are trying to hide the fact that you are using that library, for some obscure reason.

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by LinuxCoder
    Now that's a good one. From what i recall DLL stands for Dynamic Link Library. I guess that says it all doesn't it? DLL's are supposed to be linked dynamically not statically. Usually for static linking the extension in windows is .lib
    Cheers
    Some libraries come in both static and dynamic flavors so its not realy a stupid sugestion.

    I agree that including dlls in your distribution isn't a big deal, put them all in one zip file. Or you can use one of those freeware installers.

  11. #11
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    I say this is something malicious, it's the only logical explanation(forgot how to spell lol)... having to copy a dll along with the virus everywhere would just be gay I guess... It's kindof obvious since he isn't going to be keeping the exe in the same directory and even if it was legit, just moving one more file wouldn't be a "hassle"
    Pwnd
    Last edited by bikr692002; 04-08-2006 at 08:36 PM.

  12. #12
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    I say this is something malicious, it's the only logical explamation
    well, i wouldn't go all that far as to state that, i was more thinking about some kind of licensing issues. For instance, if i'm not mistaken using a library under GPL can get a user in trouble if it's a comercial application and the the source code isn't freely available.

    As stated in the Gnu General Public License:
    For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
    Last edited by LinuxCoder; 04-08-2006 at 08:50 PM.

  13. #13
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    Well of course now he's going to claim that he's doing what you said... I know bull........ters when I see them

  14. #14
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    I want to make a program where you only need a .EXE and nothing else. I dont want other people who use this program to have to hassel with the .DLL (hassel = keeping the .DLL in the same directory).
    AFAIK, there is no way create a program that eliminates the DLL unless you have the source code to the DLL. You can recompile the DLL source code into a static library and link this library with your app at compile time thus eliminating the need for a DLL. Bottom line is you need the static lib version of this DLL since I know of no way to convert a binary DLL into a static lib.

  15. #15
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    Well of course now he's going to claim that he's doing what you said
    It will lead to the same result, what i posted is not morally correct nor ethical, if it's even legal which i even think it's not.

    Cheers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Including The Right DLLs
    By bumfluff in forum Game Programming
    Replies: 8
    Last Post: 12-28-2006, 03:32 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. standart dlls
    By keeper in forum C++ Programming
    Replies: 3
    Last Post: 07-05-2006, 07:32 PM
  5. Can't load string from resource DLL's string table
    By s_k in forum Windows Programming
    Replies: 4
    Last Post: 07-15-2003, 06:43 AM