Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lib vs. dll 1

Status
Not open for further replies.

joeGrammar

Programmer
Jun 4, 2001
162
CA
Hey there I'm just curious to why a library would build fine statically, but when trying to build a dll with the same source, you would get unresolved symbol errors...
 
The DLL should have some lib what you should add to project. It doesn't mean what you link functions statically. In the lib often is the code for dinamically linking the dll. If not, you should do it in code. John Fill
1c.bmp


ivfmd@mail.md
 
I think you should study english. If you mean to write it in C++, I can give a piece of code, but what I have written there is not in russian or chinese.
Read attentive:
You can link dinamically a dll by linking a lib what contains the code for dinamically linking it. You also can do it in code, using LoadLibrary. Also there is some directive #import<>. I don't know exactly, but I believe the lib resulted after compilling/linking a dll contains the code for linking dll, without using LoadLibrary. See, after linking a dll you get also a lib. John Fill
1c.bmp


ivfmd@mail.md
 
OK but that doesn't answer my original question:

Why do you get unresolved symbol areas creating a DLL when you don't get them creating a static library LIB
 
You should declare in your project, the functions what you try to use from dll like
__declspec(dllimport) declaration here;

John Fill
1c.bmp


ivfmd@mail.md
 
but the dll is not created... its complaining about the .obj files missing definitions. The code is located in another library which is not supposed to be built yet. So I have no idea how to include symbols from source which isn't included in the library.... DO YOU?! :)
 
you must at the first include the library, if no, put s stub cpp file with somulation implementation of theese functions. It means, the function must be valid, even they make nothing. When the library will be read, remove the CPP and its OBJ and put the lib in the settings. John Fill
1c.bmp


ivfmd@mail.md
 
Go to the link option under the project properties and make sure that you have the lib files listed that contain the external symbols that you are referencing. Without this, the linker will not be able to resolve the external sysmbols. - Jeff Marler B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top