DLL vs. Static Link Library 
Author Message
 DLL vs. Static Link Library

Hi World,

I am new in programming dll. I am using VC++5 under WinMe.

After my DLL(myDLL) has been created successfully, I write a calling
App (myApp) project. But when compile, I get a LNK2001 error saying
myApp can't
resolve the dll function name.

I have included <myDLL>.h into <myApp>.cpp where I call the external
DLL functions, I also changed env var "PATH" to the location of
<myDLL>.

So, I add <myDLL>.lib into link option list, THEN LNK2001 disappears.
But the
question is: myDLL is still a Dynamic link or it has changed to be a
Static one? If it still a Dyna Link, what's the inner trick behind the
scene?

Thanks for any hint!
-Clifford



Fri, 02 Apr 2004 09:42:17 GMT  
 DLL vs. Static Link Library


Quote:
> Hi World,

> I am new in programming dll. I am using VC++5 under WinMe.

> After my DLL(myDLL) has been created successfully, I write a calling
> App (myApp) project. But when compile, I get a LNK2001 error saying
> myApp can't
> resolve the dll function name.

> I have included <myDLL>.h into <myApp>.cpp where I call the external
> DLL functions, I also changed env var "PATH" to the location of
> <myDLL>.

> So, I add <myDLL>.lib into link option list, THEN LNK2001 disappears.
> But the
> question is: myDLL is still a Dynamic link or it has changed to be a
> Static one? If it still a Dyna Link, what's the inner trick behind the
> scene?

Yes, it's still a DLL.  Your file <myDLL>.lib is what's called an "import
library".  It defines the symbols for the linker.  The symbols are defined
by "import descriptors" which are fixed-up when your application (myAPP)
loads to be absolute direct jmp instructions to the actual routine in the
DLL.  A slightly different but analogous process is used for data imported
from a DLL.

This is somewhat in contrast to the convention of *nix linkers which simply
leave undefined symbols in the application, with the expectation that
they'll be satisfied by a "shared library" when the program is loaded.

-cd



Fri, 02 Apr 2004 09:50:27 GMT  
 DLL vs. Static Link Library
It is still a dynamic link.  The compiler uses headers to resolve things
external to the module.  The linker uses libs to resolve your dll function
calls.


Quote:
> Hi World,

> I am new in programming dll. I am using VC++5 under WinMe.

> After my DLL(myDLL) has been created successfully, I write a calling
> App (myApp) project. But when compile, I get a LNK2001 error saying
> myApp can't
> resolve the dll function name.

> I have included <myDLL>.h into <myApp>.cpp where I call the external
> DLL functions, I also changed env var "PATH" to the location of
> <myDLL>.

> So, I add <myDLL>.lib into link option list, THEN LNK2001 disappears.
> But the
> question is: myDLL is still a Dynamic link or it has changed to be a
> Static one? If it still a Dyna Link, what's the inner trick behind the
> scene?

> Thanks for any hint!
> -Clifford



Fri, 02 Apr 2004 09:53:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Linking Static DLL vs Non Static DLL

2. New vs.net static library project generates LINK errors

3. New vs.net static library project generates LINK errors

4. Static vs Dynamic link of MFC library

5. MFC shared DLL vs static library

6. DoModal() crash with MFC shared DLL vs static library

7. Q: dynamic dll vs static library

8. DoModal() crash. (MFC shared DLL vs static library)

9. Static MFC library vs. DLL

10. Static vs DLL linking

11. Static link MFC DLL in VS.NET

12. Static link vs DLLs

 

 
Powered by phpBB® Forum Software