digitalmars.D.learn - Another question about making a .lib file
- Triften Chmil (14/14) Sep 13 2005 I'm trying to make a .lib from a .d file (which is basically a header to...
- Jarrett Billingsley (7/28) Sep 13 2005 Wait a second. You might have to ignore my other post.
- Triften Chmil (7/38) Sep 14 2005 I suppose this is the part where I realize that the .lib (that I got wit...
- Jarrett Billingsley (7/14) Sep 14 2005 Nope, just use implib on the sdl_mixer.dll to generate a D-compatible im...
- Triften Chmil (7/21) Sep 14 2005 Still getting undefined symbol errors.
- Triften Chmil (21/21) Sep 14 2005 Just to give you as much information as I can:
- Mike Parker (18/22) Sep 15 2005 sdl_mixer.d should be imported as a 'header', but need not be compiled
- Jarrett Billingsley (17/23) Sep 15 2005 The implib'ed lib is missing the functions? Do you mean that you dumped...
I'm trying to make a .lib from a .d file (which is basically a header to a .dll) but there seem to be some functions that are being ignored and not included in the final .lib. (This is verified by looking at the .lst.) Specifically, I have the sdl_mixer.dll from libsdl.org and the file sdl_mixer.d from D-Porting. I ran 'dmd -c SDL_mixer.d' to make the .obj then 'lib -c -l sdl_mixer sdl_mixer.obj' to make the lib. There are functions missing from the lst that are then mentioned by the linker when I compile a simple program using sdl_mixer.lib. I noticed that the functions that are missing all seem to be prototypes. Is there a flag to keep prototyped functions? Or one to include the .dll in the process so the .lib symbol can point to the .dll? Thanks, Triften Chmil P.S. Sorry if this is posted twice.
Sep 13 2005
"Triften Chmil" <Triften_member pathlink.com> wrote in message news:dg6elb$14vf$1 digitaldaemon.com...I'm trying to make a .lib from a .d file (which is basically a header to a .dll) but there seem to be some functions that are being ignored and not included in the final .lib. (This is verified by looking at the .lst.) Specifically, I have the sdl_mixer.dll from libsdl.org and the file sdl_mixer.d from D-Porting. I ran 'dmd -c SDL_mixer.d' to make the .obj then 'lib -c -l sdl_mixer sdl_mixer.obj' to make the lib. There are functions missing from the lst that are then mentioned by the linker when I compile a simple program using sdl_mixer.lib. I noticed that the functions that are missing all seem to be prototypes. Is there a flag to keep prototyped functions? Or one to include the .dll in the process so the .lib symbol can point to the .dll? Thanks, Triften ChmilWait a second. You might have to ignore my other post. Why are you trying to make the header file into a lib? Isn't there already an accompanying sdl_mixer.lib? If there's a DLL and a header, there's most likely already an "import library," which is a .lib file that just tells the compiler in what DLL to look for the function.
Sep 13 2005
In article <dg7n2c$2e2u$1 digitaldaemon.com>, Jarrett Billingsley says..."Triften Chmil" <Triften_member pathlink.com> wrote in message news:dg6elb$14vf$1 digitaldaemon.com...I suppose this is the part where I realize that the .lib (that I got with the dll) that was causing me trouble is compiled with a MS compiler therefore making it a different format. In that case, would I just need to recompile the source code for sdl_mixer.dll with a different compiler to get a useable .lib? Thanks, Triften ChmilI'm trying to make a .lib from a .d file (which is basically a header to a .dll) but there seem to be some functions that are being ignored and not included in the final .lib. (This is verified by looking at the .lst.) Specifically, I have the sdl_mixer.dll from libsdl.org and the file sdl_mixer.d from D-Porting. I ran 'dmd -c SDL_mixer.d' to make the .obj then 'lib -c -l sdl_mixer sdl_mixer.obj' to make the lib. There are functions missing from the lst that are then mentioned by the linker when I compile a simple program using sdl_mixer.lib. I noticed that the functions that are missing all seem to be prototypes. Is there a flag to keep prototyped functions? Or one to include the .dll in the process so the .lib symbol can point to the .dll? Thanks, Triften ChmilWait a second. You might have to ignore my other post. Why are you trying to make the header file into a lib? Isn't there already an accompanying sdl_mixer.lib? If there's a DLL and a header, there's most likely already an "import library," which is a .lib file that just tells the compiler in what DLL to look for the function.
Sep 14 2005
"Triften Chmil" <Triften_member pathlink.com> wrote in message news:dg91cp$pqc$1 digitaldaemon.com...I suppose this is the part where I realize that the .lib (that I got with the dll) that was causing me trouble is compiled with a MS compiler therefore making it a different format. In that case, would I just need to recompile the source code for sdl_mixer.dll with a different compiler to get a useable .lib?Nope, just use implib on the sdl_mixer.dll to generate a D-compatible import library. Implib is part of the Digital Mars Basic Utilities package, available here: http://ftp.digitalmars.com/bup.zip If you're linking in the new import library and you're _still_ getting undefined references, it might be a matter of setting up a .def file.
Sep 14 2005
In article <dg9id2$1css$1 digitaldaemon.com>, Jarrett Billingsley says..."Triften Chmil" <Triften_member pathlink.com> wrote in message news:dg91cp$pqc$1 digitaldaemon.com...Still getting undefined symbol errors. The text of the function name is in the .dll. Is implib just unable to pull out those functions for some reason? Has anyone here been able to use sdl_mixer under D (in windows)? Thanks again, Triften ChmilI suppose this is the part where I realize that the .lib (that I got with the dll) that was causing me trouble is compiled with a MS compiler therefore making it a different format. In that case, would I just need to recompile the source code for sdl_mixer.dll with a different compiler to get a useable .lib?Nope, just use implib on the sdl_mixer.dll to generate a D-compatible import library. Implib is part of the Digital Mars Basic Utilities package, available here: http://ftp.digitalmars.com/bup.zip If you're linking in the new import library and you're _still_ getting undefined references, it might be a matter of setting up a .def file.
Sep 14 2005
Just to give you as much information as I can: I've got a small soundtest.d file with "import SDL; import SDL_mixer" at the top that does the bare minimum of functions to play a WAV (initialize sound, load the sound, play it and wait for it to finish before closing.) Then I have an sdl_mixer.d from D-Porting that lists the functions that are in the .dll. I have the .lib file from running implib on sdl_mixer.dll. (I also have the .lib from the sdl_mixer_dev zip file but that's COFF.) Finally a small shell script: DMD=\dmd\bin\dmd INC=-I\d\sdl -I\d\opengl LIBS=sdl.lib opengl32.lib glu32.lib sdl_mixer.lib $(DMD) soundtest.d $(INC) $(LIBS) (END script) Running that gives me those undefined symbol errors. Should I include "sdl_mixer.d" amoing the files to compile? Or is there something else I should do to get a proper .lib file? (Again, the .lib file seems to be missing a few important functions that are in the .dll and the COFF lib file.) The original .lib is 15k, the implib version is 8k, and the coff2omf version is 6k. -Triften Chmil
Sep 14 2005
Triften Chmil wrote:Should I include "sdl_mixer.d" amoing the files to compile? Or is there something else I should do to get a proper .lib file? (Again, the .lib file seems to be missing a few important functions that are in the .dll and the COFF lib file.)sdl_mixer.d should be imported as a 'header', but need not be compiled in as long as you are linking to a proper import lib. Perhaps your import lib is corrupt? This won't solve your immediate problem of linking to the import lib, but as a workaround it bypasses the need for it. You might consider using Derelict (http://www.dsource.org/projects/derelict/). Derelict allows you to avoid linking with any C import libs. You link with Derelict's D libs instead. The Derelict packages load the appropriate shared lib files (DLLs on Windows and so files on Linux) dynamically at runtime. The project includes several SDL library loaders (SDL and SDL_mixer amongst them) and also OpenGL, OpenAL, and more. If you do use Derelict, you will need a Subversion client to check out the trunk from the repository. If you've never used subversion, there are links from the project page that lead to the information you need to do so (it's quite simple really). I also suggest browsing the Derelict forums (again linked from the project page) to get an idea of what you need to check out and what the project is about.
Sep 15 2005
"Triften Chmil" <Triften_member pathlink.com> wrote in message news:dgas58$2o2h$1 digitaldaemon.com...Should I include "sdl_mixer.d" amoing the files to compile? Or is there something else I should do to get a proper .lib file? (Again, the .lib file seems to be missing a few important functions that are in the .dll and the COFF lib file.)The implib'ed lib is missing the functions? Do you mean that you dumped a list of the functions from each library and the list was shorter for the implib'ed file? Or just that it's giving undefined references? You might be able to circumvent having to use the implib'ed lib at all, by instead using a module definition file. It's a little more work, but it's not that bad. I'll have to know a few things, first, though: 1) When the linker says that there is an undefined reference, what does say it's looking for? For example, if there's a function "sdl_mixer_init", does it look for "_sdl_mixer_init"? 2) What is the actual name of the function in the DLL? Is it just "sdl_mixer_init", or maybe "sdl_mixer_init 8", or something horrendous like "??sdl_mixer_init YAXPAXZ" ? What you can do with a module definition file is kind of set up aliases for the linker, so that it'll remap the function names that it's looking for to the actual name in the DLL.
Sep 15 2005