How do I create a static link library?

jcc7 jcc7_member at
Mon Feb 27 10:52:17 PST 2006

In article <dtlcei$1l4e$1 at>, Cris says...
>How do I create a static link library? I've seen instructions how to do 
>it with DMD but I cannot find them now.
>I have 20+ modules interfacing to a .dll and I have to include all of 
>them, when compiling or I get link errors.
>So I want to be able just to import the modules without to include all 
>source code in a project.

If want to create a .lib file, that's pretty easy. If you want to create a .dll,
I can't help you. Someone else probably can, but .dll's aren't my thing. :(

First compile your D files to produce .obj files:
dmd -c winnt.d ole2.d oleauto.d api.d windef.d commctrl.d -I..

Then use "lib" ( to create a .lib file:
lib -c win32.lib winnt.obj ole2.obj oleauto.obj api.obj windef.obj commctrl.obj 

Finally, you can compile an .exe:
dmd myprogram.d win32.lib


More information about the Digitalmars-d-learn mailing list