Dynamic Linking Libraries and including lib files

Started by
4 comments, last by PrincessDaisy 18 years, 8 months ago
Everytime I use dll's on Windows machines, I included the lib file that goes along with the dll, just to make my life a bit easier. That way I dont have to call ::LoadLibrary etc. and all associated programs can still have the dll swapped. But can I do something similar on Linux machines? I know there is an .so file, which is the equivalent of the windows .dll, but is there also an associated library file that goes along with the .so file? I know that a .la file is created also, but I don't know about the .o file. Any help would be appreciated Daisy
________________________
Pretty In Pink
Advertisement
Quote:Original post by PrincessDaisy
Everytime I use dll's on Windows machines, I included the lib file that goes along with the dll, just to make my life a bit easier. That way I dont have to call ::LoadLibrary etc. and all associated programs can still have the dll swapped.

But can I do something similar on Linux machines? I know there is an .so file, which is the equivalent of the windows .dll, but is there also an associated library file that goes along with the .so file? I know that a .la file is created also, but I don't know about the .o file.

Any help would be appreciated
Daisy


I do the same thing under Windows for my project. It is not necessary for linux though. The g++ compiler can link using the information from the .so file directly (I don't even make a .la or .a file).

Tom
Ok, that sounds good, but just to clarify (if you don't mind:) )

In my main dll, i declare a few external variables in the header file, and in windows land, I need to include the lib file, as they contain the actual variable definitions.

So in Linux land, it wont matter that the externals are declared in the so file, as linux will figure that out? Sound weird to me, but when it comes to Linux, what so i know..!

Daisy
________________________
Pretty In Pink
There is an equilavent of a .lib file for linux which is the .a file, as mentioned above you don't need to use a .a file when linking to the shared object under Linux.
Quote:Original post by PrincessDaisy
Ok, that sounds good, but just to clarify (if you don't mind:) )

In my main dll, i declare a few external variables in the header file, and in windows land, I need to include the lib file, as they contain the actual variable definitions.

So in Linux land, it wont matter that the externals are declared in the so file, as linux will figure that out? Sound weird to me, but when it comes to Linux, what so i know..!


Yes, on linux all you need is in the .so. My library has plenty of externals and works quite well on linux.

To me the weird thing is that it doesn't work like this on windows :) I see no reason why windows can't put all the info required for linking to a dll in the dll itself.

Tom
Excellent, thanks for the info. Thats made my life a lot easier, I was thinking I would have to alter a lot of my project to get it working on Linux.

Again, thanks
Daisy
________________________
Pretty In Pink

This topic is closed to new replies.

Advertisement