Thread overview
SNN.lib error when compiling DLL
Apr 04, 2007
Chris Gleinser
Apr 04, 2007
Walter Bright
Apr 05, 2007
Chris Gleinser
Apr 05, 2007
Bertel Brander
Apr 05, 2007
Chris Gleinser
Apr 05, 2007
Walter Bright
Apr 10, 2007
Chris Gleinser
Apr 10, 2007
Walter Bright
Mar 05, 2009
Nicholas Jordan
April 04, 2007
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
April 04, 2007
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.
April 05, 2007
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?
April 05, 2007
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
April 05, 2007
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...
April 05, 2007
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.
April 10, 2007
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?
April 10, 2007
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.
March 05, 2009
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