www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Cannot find symbol using wine

reply Jonathan M Davis <jmdavisProg gmx.com> writes:
I'm trying to read from the registry (thus far unsuccesfully). 
core.sys.windows.windows has RegOpenKeyExA() in it, and I'm trying to use it to 
read a registry key. However, when I use it, I get this error upon compilation:

Error 42: Symbol Undefined _RegOpenKeyExA 20

I'm using wine, and according to 
http://source.winehq.org/WineAPI/RegOpenKeyExA.html it appears to be 
implemented. So, what on earth could I be missing? Any help would be much 
appreciated.

- Jonathan M Davis
Oct 24 2010
parent reply "Denis Koroskin" <2korden gmail.com> writes:
On Mon, 25 Oct 2010 05:03:50 +0400, Jonathan M Davis <jmdavisProg gmx.com>  
wrote:

 I'm trying to read from the registry (thus far unsuccesfully).
 core.sys.windows.windows has RegOpenKeyExA() in it, and I'm trying to  
 use it to
 read a registry key. However, when I use it, I get this error upon  
 compilation:

 Error 42: Symbol Undefined _RegOpenKeyExA 20

 I'm using wine, and according to
 http://source.winehq.org/WineAPI/RegOpenKeyExA.html it appears to be
 implemented. So, what on earth could I be missing? Any help would be much
 appreciated.

 - Jonathan M Davis
This function isn't implemented in Phobos, it's implemented in advapi32.dll You either need to link with advapi32.lib or a linkage.def file with the following contents (without quotes): "EXETYPE NT IMPORTS _RegOpenKeyExA 20 = advapi32.RegOpenKeyExA" Hope that helps.
Oct 24 2010
next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday 24 October 2010 18:20:53 Denis Koroskin wrote:
 On Mon, 25 Oct 2010 05:03:50 +0400, Jonathan M Davis <jmdavisProg gmx.com>
 
 wrote:
 I'm trying to read from the registry (thus far unsuccesfully).
 core.sys.windows.windows has RegOpenKeyExA() in it, and I'm trying to
 use it to
 read a registry key. However, when I use it, I get this error upon
 compilation:
 
 Error 42: Symbol Undefined _RegOpenKeyExA 20
 
 I'm using wine, and according to
 http://source.winehq.org/WineAPI/RegOpenKeyExA.html it appears to be
 implemented. So, what on earth could I be missing? Any help would be much
 appreciated.
 
 - Jonathan M Davis
This function isn't implemented in Phobos, it's implemented in advapi32.dll You either need to link with advapi32.lib or a linkage.def file with the following contents (without quotes): "EXETYPE NT IMPORTS _RegOpenKeyExA 20 = advapi32.RegOpenKeyExA" Hope that helps.
I haven't had this problem with any other windows calls that I've used. As long as they've been in druntime, they've worked. Are you suggesting that that's the case because Phobos or druntime also happened to link aganst any of the other windows functions that I've used, and that in this case, they don't, so I have to link it explicitly? - Jonathan M Davis
Oct 24 2010
parent "Denis Koroskin" <2korden gmail.com> writes:
On Mon, 25 Oct 2010 07:33:40 +0400, Jonathan M Davis <jmdavisProg gmx.com>  
wrote:

 On Sunday 24 October 2010 18:20:53 Denis Koroskin wrote:
 On Mon, 25 Oct 2010 05:03:50 +0400, Jonathan M Davis  
 <jmdavisProg gmx.com>

 wrote:
 I'm trying to read from the registry (thus far unsuccesfully).
 core.sys.windows.windows has RegOpenKeyExA() in it, and I'm trying to
 use it to
 read a registry key. However, when I use it, I get this error upon
 compilation:

 Error 42: Symbol Undefined _RegOpenKeyExA 20

 I'm using wine, and according to
 http://source.winehq.org/WineAPI/RegOpenKeyExA.html it appears to be
 implemented. So, what on earth could I be missing? Any help would be  
much
 appreciated.

 - Jonathan M Davis
This function isn't implemented in Phobos, it's implemented in advapi32.dll You either need to link with advapi32.lib or a linkage.def file with the following contents (without quotes): "EXETYPE NT IMPORTS _RegOpenKeyExA 20 = advapi32.RegOpenKeyExA" Hope that helps.
I haven't had this problem with any other windows calls that I've used. As long as they've been in druntime, they've worked. Are you suggesting that that's the case because Phobos or druntime also happened to link aganst any of the other windows functions that I've used, and that in this case, they don't, so I have to link it explicitly? - Jonathan M Davis
Yes, it links with some of the libraries implicitly.
Oct 25 2010
prev sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday 24 October 2010 20:33:40 Jonathan M Davis wrote:
 On Sunday 24 October 2010 18:20:53 Denis Koroskin wrote:
 On Mon, 25 Oct 2010 05:03:50 +0400, Jonathan M Davis
 <jmdavisProg gmx.com>
 
 wrote:
 I'm trying to read from the registry (thus far unsuccesfully).
 core.sys.windows.windows has RegOpenKeyExA() in it, and I'm trying to
 use it to
 read a registry key. However, when I use it, I get this error upon
 compilation:
 
 Error 42: Symbol Undefined _RegOpenKeyExA 20
 
 I'm using wine, and according to
 http://source.winehq.org/WineAPI/RegOpenKeyExA.html it appears to be
 implemented. So, what on earth could I be missing? Any help would be
 much appreciated.
This function isn't implemented in Phobos, it's implemented in advapi32.dll You either need to link with advapi32.lib or a linkage.def file with the following contents (without quotes): "EXETYPE NT IMPORTS _RegOpenKeyExA 20 = advapi32.RegOpenKeyExA" Hope that helps.
I haven't had this problem with any other windows calls that I've used. As long as they've been in druntime, they've worked. Are you suggesting that that's the case because Phobos or druntime also happened to link aganst any of the other windows functions that I've used, and that in this case, they don't, so I have to link it explicitly?
It looks liking adding advapi32.lib to the compilation command does the trick, but I don't know why I've never needed to do that before with other Windows functions. - Jonathan M Davis
Oct 24 2010
parent torhu <no spam.invalid> writes:
On 25.10.2010 08:06, Jonathan M Davis wrote:
[...]
 It looks liking adding advapi32.lib to the compilation command does the trick,
 but I don't know why I've never needed to do that before with other Windows
 functions.
Just guessing, but it might be that dmd doesn't add advapi32.dll to the linker's command line by default. You can probably verify that by passing -v to dmd, to see the linker commands being used.
Oct 25 2010