www.digitalmars.com         C & C++   DMDScript  

D - linker problem

reply "Lloyd Dupont" <lloyd galador.net> writes:
I have a dummy question:

I tried to compile a simple code like this:

import windows;
import string;

// dmd -o a.exe un.d && a
int main(char[][] args)
{
    RegCloseKey(HKEY_LOCAL_MACHINE);
    return 0;
}

but I have error 42: Undefined Symbol _RegCloseKey 4
well, I should include the correct library, I thought....
it was unclear how to do that, finally I tried
 dmd -o a.exe un.d KERNEL32.LIB
at this time (with the output of the linker) I reallize that kernel32 was already linked, and that I have no idea how to know which library is needed. Fortunately MS doc told me the answers... But I wonder is there a tool, like dependancy walker, which could told you which symbol are defined in a .LIB file ?
Nov 21 2002
parent reply Evan McClanahan <evan dontSPAMaltarinteractive.com> writes:
The library that you need is: advapi32.lib

I found it through the MSVC++ documentation, so I can't really help you 
with a tool that could find the libs that you need.  It usually is only 
a problem for a few minutes of searching, so I almost doubt that there's 
one out there...


Evan


Lloyd Dupont wrote:
 I have a dummy question:
 
 I tried to compile a simple code like this:

 import windows;
 import string;
 
 // dmd -o a.exe un.d && a
 int main(char[][] args)
 {
     RegCloseKey(HKEY_LOCAL_MACHINE);
     return 0;
 }

 but I have error 42: Undefined Symbol _RegCloseKey 4
 well, I should include the correct library, I thought....
 it was unclear how to do that, finally I tried
 
dmd -o a.exe un.d KERNEL32.LIB
at this time (with the output of the linker) I reallize that kernel32 was already linked, and that I have no idea how to know which library is needed. Fortunately MS doc told me the answers... But I wonder is there a tool, like dependancy walker, which could told you which symbol are defined in a .LIB file ?
Nov 21 2002
next sibling parent Lloyd Dupont <lloyd galador.net> writes:
oh.. yes,..
I later found it in the doc too.
In fact I never pay attention to the lib section in the documentation up 
to now and was quite happily surprised to see it.
newvermind.

regards,
Lloyd

Evan McClanahan wrote:

 The library that you need is: advapi32.lib

 I found it through the MSVC++ documentation, so I can't really help you
 with a tool that could find the libs that you need.  It usually is only
 a problem for a few minutes of searching, so I almost doubt that there's
 one out there...
Nov 21 2002
prev sibling parent "Walter" <walter digitalmars.com> writes:
"Evan McClanahan" <evan dontSPAMaltarinteractive.com> wrote in message
news:arii9s$a07$1 digitaldaemon.com...
 The library that you need is: advapi32.lib

 I found it through the MSVC++ documentation, so I can't really help you
 with a tool that could find the libs that you need.  It usually is only
 a problem for a few minutes of searching, so I almost doubt that there's
 one out there...
I just run grep over the .lib files.
Nov 22 2002