Thread overview
Making a .lib in D
Sep 13, 2005
Triften Chmil
Sep 14, 2005
Carlos Santander
Sep 14, 2005
Triften Chmil
Sep 14, 2005
Carlos Santander
September 13, 2005
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
September 13, 2005
"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.


September 14, 2005
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
September 14, 2005
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
September 14, 2005
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