www.digitalmars.com         C & C++   DMDScript  

c++ - libraries

reply Brecht Machiels <brecht mos6581.org> writes:
Hello,

I'd like to replace the slow MinGW GCC with DMC. Unfortunately, DMC 
doesn't seem to be supported by any of the libraries I use, so I have to 
waste time with implib and/or adjusting makefiles to generate the .lib 
files to link with.

I've been having "fun" for a couple of hours now trying to compile a 
very simple SDL application. Fortunately SDL comes with libs for the 
Borland compiler. I'm currently stuck at the following error message 
(during linking):

"OPTLINK : Warning 134: No Start Address"

Doing some more googling, I came across a tip to specify /ENTRY. Using 
"/ENTRY:WinMain" gets me a little bit further:

C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined __streams
C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetModuleHandleA
C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined _SDL_main
C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined ___alloca_helper
C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined LoadLibraryA
C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined FreeLibrary
C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetCommandLineA

Stuff like this has made me give up on DMC in the past... Yes there are 
some clues in the newsgroup archives, but it remains to be a real chore.

And once I finally get the SDL library to link properly with my little 
application, I soon will have similar wonderful adventures with libpng, 
libz, libjpeg and many others! :(

Is there perhaps a repository of pre-built libs for DMC, or perhaps a 
straight-forward guide to work with third party libraries (a wiki 
perhaps)? Something in the style of the Dev-C++ devpacks would be a godsend.

Please help me get past this library-hacking, so I can do what I wanted 
to do in the first place: compile *my* code.

I apologize for any traces of sarcasm in the above.

Regards,
soon-to-go-berserk Brecht
Jan 20 2007
next sibling parent reply Walter Bright <newshound digitalmars.com> writes:
Brecht Machiels wrote:
 Hello,
 
 I'd like to replace the slow MinGW GCC with DMC. Unfortunately, DMC 
 doesn't seem to be supported by any of the libraries I use, so I have to 
 waste time with implib and/or adjusting makefiles to generate the .lib 
 files to link with.
 
 I've been having "fun" for a couple of hours now trying to compile a 
 very simple SDL application. Fortunately SDL comes with libs for the 
 Borland compiler. I'm currently stuck at the following error message 
 (during linking):
 
 "OPTLINK : Warning 134: No Start Address"
 
 Doing some more googling, I came across a tip to specify /ENTRY. Using 
 "/ENTRY:WinMain" gets me a little bit further:
 
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined __streams
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetModuleHandleA
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined _SDL_main
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined ___alloca_helper
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined LoadLibraryA
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined FreeLibrary
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetCommandLineA

 Stuff like this has made me give up on DMC in the past... Yes there are 
 some clues in the newsgroup archives, but it remains to be a real chore.
The easy way to find out which library a name is defined in is: grep GetCommandLineA \dm\lib\*.lib which gives: \dm\lib\kernel32.lib:.GetCommandLineA \dm\lib\kernel32.lib:._GetCommandLineA 0.KERNEL32.GetCommandLineA \dm\lib\kernel32.lib:._GetCommandLineA 0f. \dm\lib\SCRNSAVE.LIB:.__imp__GetCommandLineA 0 \dm\lib\SND.lib:.__imp__GetCommandLineA 0 \dm\lib\SND.lib:.__imp__GetCommandLineA 0 \dm\lib\SND.lib:.__imp__GetCommandLineA 0 \dm\lib\SNDD.lib:.__imp__GetCommandLineA 0 \dm\lib\SNDD.lib:.__imp__GetCommandLineA 0 \dm\lib\SNDD.lib:.__imp__GetCommandLineA 0 \dm\lib\snn.lib:.__imp__GetCommandLineA 0 \dm\lib\snn.lib:.__imp__GetCommandLineA 0 \dm\lib\snn.lib:.__imp__GetCommandLineA 0 \dm\lib\snnd.lib:.__imp__GetCommandLineA 0 \dm\lib\snnd.lib:.__imp__GetCommandLineA 0 \dm\lib\snnd.lib:.__imp__GetCommandLineA 0 Looks like you need to link in kernel32.lib.
 And once I finally get the SDL library to link properly with my little 
 application, I soon will have similar wonderful adventures with libpng, 
 libz, libjpeg and many others! :(
 
 Is there perhaps a repository of pre-built libs for DMC, or perhaps a 
 straight-forward guide to work with third party libraries (a wiki 
 perhaps)? Something in the style of the Dev-C++ devpacks would be a 
 godsend.
 
 Please help me get past this library-hacking, so I can do what I wanted 
 to do in the first place: compile *my* code.
 
 I apologize for any traces of sarcasm in the above.
 
 Regards,
 soon-to-go-berserk Brecht
Jan 20 2007
parent reply Brecht Machiels <brecht mos6581.org> writes:
Hello,

It seems kernel32 is linked in by default. Running

dmc.exe "..\common\timer.obj" "..\common\conio.obj" "..\common\vga.obj" 
-ostars_sdl.exe SDLmain.lib SDL.lib -L/ENTRY:WinMain

results in the following OPTLINK call:

link 
..\common\timer.obj+..\common\conio.obj+..\common\vga.obj,stars_sdl.exe,,SD
Lmain+SDL+user32+kernel32/noi/ENTRY:WinMain;

Notice "kernel32" in there. I also tried adding kernel32.lib explicitly:

dmc.exe "..\common\timer.obj" "..\common\conio.obj" "..\common\vga.obj" 
-ostars_sdl.exe SDLmain.lib SDL.lib kernel32.lib -L/ENTRY:WinMain

which results in

link 
..\common\timer.obj+..\common\conio.obj+..\common\vga.obj,stars_sdl.exe,,SD
Lmain+SDL+kernel32+user32+kernel32/noi/ENTRY:WinMain;

OPTLINK returns the same errors though.

Any ideas?

On a side note, a library repository for DMC such as http://devpaks.org/ 
for MinGW would be great. I'm sure many of the DMC users out there have 
each built some libraries with/for DMC. Perhaps it's possible to collect 
those somewhere?

Regards,
Brecht

Walter Bright wrote:
 Brecht Machiels wrote:
 Hello,

 I'd like to replace the slow MinGW GCC with DMC. Unfortunately, DMC 
 doesn't seem to be supported by any of the libraries I use, so I have 
 to waste time with implib and/or adjusting makefiles to generate the 
 .lib files to link with.

 I've been having "fun" for a couple of hours now trying to compile a 
 very simple SDL application. Fortunately SDL comes with libs for the 
 Borland compiler. I'm currently stuck at the following error message 
 (during linking):

 "OPTLINK : Warning 134: No Start Address"

 Doing some more googling, I came across a tip to specify /ENTRY. Using 
 "/ENTRY:WinMain" gets me a little bit further:

 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined __streams
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetModuleHandleA
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined _SDL_main
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined ___alloca_helper
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined LoadLibraryA
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined FreeLibrary
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetCommandLineA

 Stuff like this has made me give up on DMC in the past... Yes there 
 are some clues in the newsgroup archives, but it remains to be a real 
 chore.
The easy way to find out which library a name is defined in is: grep GetCommandLineA \dm\lib\*.lib which gives: \dm\lib\kernel32.lib:.GetCommandLineA \dm\lib\kernel32.lib:._GetCommandLineA 0.KERNEL32.GetCommandLineA \dm\lib\kernel32.lib:._GetCommandLineA 0f. \dm\lib\SCRNSAVE.LIB:.__imp__GetCommandLineA 0 \dm\lib\SND.lib:.__imp__GetCommandLineA 0 \dm\lib\SND.lib:.__imp__GetCommandLineA 0 \dm\lib\SND.lib:.__imp__GetCommandLineA 0 \dm\lib\SNDD.lib:.__imp__GetCommandLineA 0 \dm\lib\SNDD.lib:.__imp__GetCommandLineA 0 \dm\lib\SNDD.lib:.__imp__GetCommandLineA 0 \dm\lib\snn.lib:.__imp__GetCommandLineA 0 \dm\lib\snn.lib:.__imp__GetCommandLineA 0 \dm\lib\snn.lib:.__imp__GetCommandLineA 0 \dm\lib\snnd.lib:.__imp__GetCommandLineA 0 \dm\lib\snnd.lib:.__imp__GetCommandLineA 0 \dm\lib\snnd.lib:.__imp__GetCommandLineA 0 Looks like you need to link in kernel32.lib.
 And once I finally get the SDL library to link properly with my little 
 application, I soon will have similar wonderful adventures with 
 libpng, libz, libjpeg and many others! :(

 Is there perhaps a repository of pre-built libs for DMC, or perhaps a 
 straight-forward guide to work with third party libraries (a wiki 
 perhaps)? Something in the style of the Dev-C++ devpacks would be a 
 godsend.

 Please help me get past this library-hacking, so I can do what I 
 wanted to do in the first place: compile *my* code.

 I apologize for any traces of sarcasm in the above.

 Regards,
 soon-to-go-berserk Brecht
Jan 20 2007
parent reply Walter Bright <newshound digitalmars.com> writes:
Brecht Machiels wrote:
 Any ideas?
optlink probably isn't finding kernel32.lib. Verify that you have it, that it is in the right place, and your LIB environment variable is set up to point to it.
Jan 20 2007
parent reply Brecht Machiels <brecht mos6581.org> writes:
Walter Bright wrote:
 Brecht Machiels wrote:
 Any ideas?
optlink probably isn't finding kernel32.lib. Verify that you have it, that it is in the right place, and your LIB environment variable is set up to point to it.
I believe it does find kernel32.lib. It comes with the compiler, no? When I try to link with kernel33.lib like this: ^^ link ..\common\timer.obj+..\common\conio.obj+..\common\vga.obj,stars_sdl.exe,,SDLmain+SDL+user32+kernel33/noi/ENTRY:WinMain the results are: kernel33.lib Warning 2: File Not Found kernel33.lib C:\Program Files\dm\bin\..\lib\SNN.lib(_exit) Error 42: Symbol Undefined _ExitProcess 4 <more of this kind> C:\Program Files\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main) Error 42: Symbol Undefined __streams C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main) Error 42: Symbol Undefined GetModuleHandleA C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main) Error 42: Symbol Undefined _SDL_main C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main) Error 42: Symbol Undefined ___alloca_helper C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main) Error 42: Symbol Undefined LoadLibraryA C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main) Error 42: Symbol Undefined FreeLibrary C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main) Error 42: Symbol Undefined GetCommandLineA C:\Program Files\dm\bin\..\lib\SNN.lib(_fopen) Error 42: Symbol Undefined _CreateFileA 28 So it definitely complains when it doesn't find a lib. I suspect the link errors have something to do with the decoration of function names. It always seems to come down to that. Thanks for your patience, Brecht
Jan 21 2007
parent Walter Bright <newshound digitalmars.com> writes:
Brecht Machiels wrote:
 So it definitely complains when it doesn't find a lib. I suspect the 
 link errors have something to do with the decoration of function names. 
 It always seems to come down to that.
The next step is write a trivial D program that just calls a function in kernel32.lib. See if that works.
Jan 21 2007
prev sibling next sibling parent "Pavel Vozenilek" <pavel_vozenilek yahoo.co.uk> writes:
"Brecht Machiels" wrote:

 I'd like to replace the slow MinGW GCC with DMC.
Partially OT: Dev-Cpp now has an experimental support for DMC (with a devpak). The relevant discussion is on: http://wxforum.shadonet.com/viewtopic.php?t=12155 /Pavel
Jan 20 2007
prev sibling next sibling parent reply chris elliott <biol75 york.ac.uk> writes:
LoadLibraryA and getmodulehandleA suggest failures with linking with 
unicode/ansi

It's unlikely that libraries compiled for Borland would link with DMC

chris



Brecht Machiels wrote:
 Hello,
 
 I'd like to replace the slow MinGW GCC with DMC. Unfortunately, DMC 
 doesn't seem to be supported by any of the libraries I use, so I have to 
 waste time with implib and/or adjusting makefiles to generate the .lib 
 files to link with.
 
 I've been having "fun" for a couple of hours now trying to compile a 
 very simple SDL application. Fortunately SDL comes with libs for the 
 Borland compiler. I'm currently stuck at the following error message 
 (during linking):
 
 "OPTLINK : Warning 134: No Start Address"
 
 Doing some more googling, I came across a tip to specify /ENTRY. Using 
 "/ENTRY:WinMain" gets me a little bit further:
 
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined __streams
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetModuleHandleA
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined _SDL_main
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined ___alloca_helper
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined LoadLibraryA
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined FreeLibrary
 C:\Program Files\dm\local\lib\SDLmain.lib(SDL_main)
  Error 42: Symbol Undefined GetCommandLineA
 
 Stuff like this has made me give up on DMC in the past... Yes there are 
 some clues in the newsgroup archives, but it remains to be a real chore.
 
 And once I finally get the SDL library to link properly with my little 
 application, I soon will have similar wonderful adventures with libpng, 
 libz, libjpeg and many others! :(
 
 Is there perhaps a repository of pre-built libs for DMC, or perhaps a 
 straight-forward guide to work with third party libraries (a wiki 
 perhaps)? Something in the style of the Dev-C++ devpacks would be a 
 godsend.
 
 Please help me get past this library-hacking, so I can do what I wanted 
 to do in the first place: compile *my* code.
 
 I apologize for any traces of sarcasm in the above.
 
 Regards,
 soon-to-go-berserk Brecht
Jan 22 2007
parent Brecht Machiels <brecht mos6581.org> writes:
Hello,

chris elliott wrote:
 LoadLibraryA and getmodulehandleA suggest failures with linking with 
 unicode/ansi
 
 It's unlikely that libraries compiled for Borland would link with DMC
That might indeed have been the problem. I have finally managed to get the SDL application working. I have generated an import library with the help of implib and compiled SDL_main from source and link with that instead. The window frame looks a bit retro though (old windows headers supplied with DMC?). But for the rest it runs fine. Regards, Brecht
Jan 23 2007
prev sibling parent "copx" <copx gazeta.pl> writes:
"Brecht Machiels" <brecht mos6581.org> schrieb im Newsbeitrag
news:eoteav$28dg$1 digitaldaemon.com...
 Hello,

 I'd like to replace the slow MinGW GCC with DMC. Unfortunately, DMC doesn't
seem to be supported by any of the libraries I use, so 
 I have to waste time with implib and/or adjusting makefiles to generate the
.lib files to link with.
We are in the same situation!
Jan 28 2007