www.digitalmars.com         C & C++   DMDScript  

c++ - SNN.lib error when compiling DLL

reply Chris Gleinser <email christian-gleinser.de> writes:
Hello,

finally I managed to compile a DLL with Microsoft's C++ compiler, but I'd like
to use Digital Mars for that. When I use Mars for normal stuff, it's no
problem, however, when I try to compile a DLL, I get errors like:

C:\(blabla...)\SNN.lib(cinit)
Error 42: Symbol Undefined _GetEnvironmentStrings 0

...and approx. 20 more of those, all of them have issues with the SNN.lib and
all of them are Error 42 with some function that can't be resolved.
What am I doing wrong? Is there anything I could try?

Thanks for your help,
Chris
Apr 04 2007
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Chris Gleinser wrote:
 Hello,
 
 finally I managed to compile a DLL with Microsoft's C++ compiler, but I'd like
 to use Digital Mars for that. When I use Mars for normal stuff, it's no
 problem, however, when I try to compile a DLL, I get errors like:
 
 C:\(blabla...)\SNN.lib(cinit)
 Error 42: Symbol Undefined _GetEnvironmentStrings 0
 
 ...and approx. 20 more of those, all of them have issues with the SNN.lib and
 all of them are Error 42 with some function that can't be resolved.
 What am I doing wrong? Is there anything I could try?
 
 Thanks for your help,
 Chris
Make sure you're linking with kernel32.lib.
Apr 04 2007
parent reply Chris Gleinser <email christian-gleinser.de> writes:
Thanks for your reply,

however, I checked my lib-path and it has got the dm\lib-directory, where
kernel32.lib is located, as its very first entry. So I assume the linker should
find the lib?
Apr 05 2007
parent reply Bertel Brander <bertel post4.tele.dk> writes:
Chris Gleinser skrev:
 Thanks for your reply,
 
 however, I checked my lib-path and it has got the dm\lib-directory, where
 kernel32.lib is located, as its very first entry. So I assume the linker should
 find the lib?
You need to tell dmc that it hast to link to kernel32.lib when you are building dll's, like: dmc -mn -WD mydll.cpp kernel32.lib -- Just another homepage: http://damb.dk But it's mine - Bertel
Apr 05 2007
next sibling parent reply Chris Gleinser <email christian-gleinser.de> writes:
Ahh perfect ;) it works now, thanks!
But the DLL has double size (400 kb instead of 200), well I'm aware that
different compilers produce different output files, but could it be that I dmc
included some extra files / libs that are not neccessary and can be omitted
somehow?

Sorry for those questions but I'm not too experienced with compilers and
especially with their direct commandline interfaces...
Apr 05 2007
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Chris Gleinser wrote:
 Ahh perfect ;) it works now, thanks!
 But the DLL has double size (400 kb instead of 200), well I'm aware that
 different compilers produce different output files, but could it be that I dmc
 included some extra files / libs that are not neccessary and can be omitted
 somehow?
First, check to see if you have codeview symbolic debug info enabled. Second, look at the generated .map file to see what is in the dll.
Apr 05 2007
parent reply Chris Gleinser <email christian-gleinser.de> writes:
Well, I didn't use any of the "g" options, so I assume there's no debug info in
my compiled output - or do I have to look somewhere else?

And to be honest, I don't understand the map-file ;) is there any resource
where I can find information on how to read the map file?
Apr 09 2007
parent Walter Bright <newshound1 digitalmars.com> writes:
Chris Gleinser wrote:
 Well, I didn't use any of the "g" options, so I assume there's no debug info in
 my compiled output - or do I have to look somewhere else?
 
 And to be honest, I don't understand the map-file ;) is there any resource
 where I can find information on how to read the map file?
There isn't much to it - just a list of global symbols, the modules they came from, and their addresses in the resulting executable.
Apr 10 2007
prev sibling parent Nicholas Jordan <ab5_041 inbox.com> writes:
Like this ( ? ):

-L/ linker_options.txt -p -GT8 -HDF:\pch -mn -WD -l.zarfListing -
HD"C:\Documents and Settings\Owner\My Documents\db\pss\util" -
ozarfOCR.dll zarfDLL.c  kernel32.lib
Mar 05 2009