www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Making a .lib in D

reply Triften Chmil <Triften_member pathlink.com> writes:
I'm trying to compile a .d and make a .lib but the .lib seems to be missing
functions. I verified the behavior by generating a .lst and seeing that some
functions from the .d weren't in the .lst.

Specifically, I'm trying to compile a .lib for sdl_mixer. I got SDL_mixer.dll
from libsdl.org and 'sdl_mixer.d' from D-Porting. I ran 'dmd -c SDL_mixer.d' to
make sdl_mixer.obj, then 'lib -c -l sdl_mixer sdl_mixer.obj' to make the lib.
But then when I compile a simple program, at linking, I get errors for undefined
symbols. The functions mentioned are (prototyped at least) in sdl_mixer.d.

Is there an option in the compiler to keep the functions that are prototyped but
not defined? Or do I need to pass an option with the .dll name so that it can
verify that those functions really exist?

Thanks,
Triften Chmil
Sep 13 2005
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Triften Chmil" <Triften_member pathlink.com> wrote in message 
news:dg6eak$14o1$1 digitaldaemon.com...
 Is there an option in the compiler to keep the functions that are 
 prototyped but
 not defined? Or do I need to pass an option with the .dll name so that it 
 can
 verify that those functions really exist?

I really wish there were. What you'll have to do instead is have two modules: sdl_mixer.d and sdl_mixer_imports.d. Copy all the function prototypes of the undefined functions to sdl_mixer_imports.d. place an "import sdl_mixer_imports;" statement at the top of sdl_mixer.d. Compile _only_ sdl_mixer.d; do not compile sdl_mixer_imports.d. Then make your lib. Those references should hopefully appear in your lib file.
Sep 13 2005
prev sibling parent reply Carlos Santander <csantander619 gmail.com> writes:
Triften Chmil escribió:
 I'm trying to compile a .d and make a .lib but the .lib seems to be missing
 functions. I verified the behavior by generating a .lst and seeing that some
 functions from the .d weren't in the .lst.
 
 Specifically, I'm trying to compile a .lib for sdl_mixer. I got SDL_mixer.dll
 from libsdl.org and 'sdl_mixer.d' from D-Porting. I ran 'dmd -c SDL_mixer.d' to
 make sdl_mixer.obj, then 'lib -c -l sdl_mixer sdl_mixer.obj' to make the lib.
 But then when I compile a simple program, at linking, I get errors for
undefined
 symbols. The functions mentioned are (prototyped at least) in sdl_mixer.d.
 
 Is there an option in the compiler to keep the functions that are prototyped
but
 not defined? Or do I need to pass an option with the .dll name so that it can
 verify that those functions really exist?
 
 Thanks,
 Triften Chmil

You need to import the .dll in a .lib using 'lib', not creating a D module. Check the docs for the lib tool to know how to use it. -- Carlos Santander Bernal
Sep 13 2005
parent reply Triften Chmil <Triften_member pathlink.com> writes:
In article <dg7qqm$2h1m$1 digitaldaemon.com>, Carlos Santander says...
Triften Chmil escribió:
 I'm trying to compile a .d and make a .lib but the .lib seems to be missing
 functions. I verified the behavior by generating a .lst and seeing that some
 functions from the .d weren't in the .lst.
 
 Specifically, I'm trying to compile a .lib for sdl_mixer. I got SDL_mixer.dll
 from libsdl.org and 'sdl_mixer.d' from D-Porting. I ran 'dmd -c SDL_mixer.d' to
 make sdl_mixer.obj, then 'lib -c -l sdl_mixer sdl_mixer.obj' to make the lib.
 But then when I compile a simple program, at linking, I get errors for
undefined
 symbols. The functions mentioned are (prototyped at least) in sdl_mixer.d.
 
 Is there an option in the compiler to keep the functions that are prototyped
but
 not defined? Or do I need to pass an option with the .dll name so that it can
 verify that those functions really exist?
 
 Thanks,
 Triften Chmil

You need to import the .dll in a .lib using 'lib', not creating a D module. Check the docs for the lib tool to know how to use it. -- Carlos Santander Bernal

I don't see any mention of dll's on the doc page for 'lib'. Where does it talk about this? Oh wait, I think I need to run COFF2OMF on the .lib I have. Thanks, Triften Chmil
Sep 14 2005
parent Carlos Santander <csantander619 gmail.com> writes:
Triften Chmil escribió:
 
 
 I don't see any mention of dll's on the doc page for 'lib'. Where does it talk
 about this? Oh wait, I think I need to run COFF2OMF on the .lib I have.
 
 Thanks,
 Triften Chmil

My bad, sorry. It's implib, like Jarrett said. -- Carlos Santander Bernal
Sep 14 2005