www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



c++ - SNN.lib error when compiling DLL

↑ ↓ ← 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ → 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