www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMC to Create C .lib ?

reply Chris Andrews <CodexArcanum gmail.com> writes:
I'm working on a wrapper to a C dll and I think that I'll need to create a .lib
file eventually to connect my D code to the C library.  

I've experimented with this a little, including using ipmlib to create the lib,
which creates a lib but not one that works right (I think it mangles the names
wrong.)  However, the excellent linkdef tool works to create a good .def which
allows implib to create a proper lib.

Still, that seems a fussy way to build this: write it wrong, break it, use
linkdef and implib to fix it.  I have the source code for that dll, so what I'm
wondering is, can I just use some other DM tools (DMC?) to compile that C code
and get a proper .lib from that?
Mar 19 2009
next sibling parent Sergey Gromov <snake.scaly gmail.com> writes:
Thu, 19 Mar 2009 17:27:30 -0400, Chris Andrews wrote:

 I'm working on a wrapper to a C dll and I think that I'll need to create a
.lib file eventually to connect my D code to the C library.  
 
 I've experimented with this a little, including using ipmlib to create the
lib, which creates a lib but not one that works right (I think it mangles the
names wrong.)  However, the excellent linkdef tool works to create a good .def
which allows implib to create a proper lib.
 
 Still, that seems a fussy way to build this: write it wrong, break it, use
linkdef and implib to fix it.  I have the source code for that dll, so what I'm
wondering is, can I just use some other DM tools (DMC?) to compile that C code
and get a proper .lib from that?

Use coffimplib on your regular .lib file: http://www.digitalmars.com/ctg/coffimplib.html Get it at ftp.digitalmars.com. I'm advertising coffimplib so much that I probably need a badge already, "Want to create an import library? Ask me how!"
Mar 19 2009
prev sibling parent Trass3r <mrmocool gmx.de> writes:
Chris Andrews schrieb:
 Still, that seems a fussy way to build this: write it wrong, break it, use
linkdef and implib to fix it.  I have the source code for that dll, so what I'm
wondering is, can I just use some other DM tools (DMC?) to compile that C code
and get a proper .lib from that?

If you have source code, you can of course compile a static library. dmc -c *.c lib -c libname.lib *.obj
Mar 19 2009