www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Totally Lost Trying to Use DWin

reply Benji Smith <dlanguage benjismith.net> writes:
I'm trying to use the DWin Registry module in my code, and I'm pretty 
stumped just trying to figure out the steps.

I'm using DMD 1.33 on Windows XP SP3, with Tango 0.99.7 and DWin 0.38. 
I'm building with DSSS 0.75.

I've followed the instructions here ( http://dsource.org/projects/dwin ) 
to build the DWin library, and now I've got a file sitting here called 
"C:\dmd\dwin.lib" and I have no idea what to do with it.

I tried directly copying the example code from the Registry module, but 
it won't compile:

regtest.d:
---------------------------------------------------------------
module regtest;

import dwin.sys.win32.Registry;

import tango.io.Stdout;
import tango.text.convert.Sprint;

void main()
{
     char[] result;
     scope httpkey = 
RegistryKey.classesRoot.openSubKey(r"HTTP\shell\open\command");
     if(httpkey !is null)
     {
         result = httpkey.getValue!(char[])(null);
         Stdout(result).newline;
         //"C:\Program Files\Internet Explorer\iexplore.exe" -nohome
     }
     else
         Stdout("failed").newline;

}


dsss.conf:
---------------------------------------------------------------
name = regtest
[regtest.d]
target = regtest


But when I run "dsss build", I get the following error:

regtest.d => regtest
+ D:\Development\d\libs\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ 
-ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib\ 
  -ID:\Development\d\libs\dsss\include\d 
-SD:\Development\d\libs\dsss\lib  -oqdsss_objs\D  regtest.d -ofregtest
regtest.d(3): module Registry cannot read file 'dwin\sys\win32\Registry.d'
Command D:\Development\d\libs\dsss\bin\rebuild.exe returned with code 1, 
aborting.
Error: Command failed, aborting.


So... why can't it read 'dwin\sys\win32\Registry.d'? It it a compiler 
error or a DSSS error?

As a longtime java programmer, I know how to set the classpath to tell 
the java compiler or JVM where to find libraries. But I don't know how 
to tell the DMD or DSSS. I assumed that building the DWin library (in a 
subdirectory of DMD, of all places!) would immediately make it available.

But I'm completely clueless and need some guidance.

Thanks!

--benji
Aug 10 2008
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Benji Smith wrote:

 I'm trying to use the DWin Registry module in my code, and I'm pretty
 stumped just trying to figure out the steps.
 
 I'm using DMD 1.33 on Windows XP SP3, with Tango 0.99.7 and DWin 0.38.
 I'm building with DSSS 0.75.
 
 I've followed the instructions here ( http://dsource.org/projects/dwin )
 to build the DWin library, and now I've got a file sitting here called
 "C:\dmd\dwin.lib" and I have no idea what to do with it.
 
 I tried directly copying the example code from the Registry module, but
 it won't compile:
 
 regtest.d:
 ---------------------------------------------------------------
 module regtest;
 
 import dwin.sys.win32.Registry;
 
 import tango.io.Stdout;
 import tango.text.convert.Sprint;
 
 void main()
 {
      char[] result;
      scope httpkey =
 RegistryKey.classesRoot.openSubKey(r"HTTP\shell\open\command");
      if(httpkey !is null)
      {
          result = httpkey.getValue!(char[])(null);
          Stdout(result).newline;
          //"C:\Program Files\Internet Explorer\iexplore.exe" -nohome
      }
      else
          Stdout("failed").newline;
 
 }
 
 
 dsss.conf:
 ---------------------------------------------------------------
 name = regtest
 [regtest.d]
 target = regtest
 
 
 But when I run "dsss build", I get the following error:
 
 regtest.d => regtest
 + D:\Development\d\libs\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\
 -ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib\
   -ID:\Development\d\libs\dsss\include\d
 -SD:\Development\d\libs\dsss\lib  -oqdsss_objs\D  regtest.d -ofregtest
 regtest.d(3): module Registry cannot read file 'dwin\sys\win32\Registry.d'
 Command D:\Development\d\libs\dsss\bin\rebuild.exe returned with code 1,
 aborting.
 Error: Command failed, aborting.
 
 
 So... why can't it read 'dwin\sys\win32\Registry.d'? It it a compiler
 error or a DSSS error?
 
 As a longtime java programmer, I know how to set the classpath to tell
 the java compiler or JVM where to find libraries. But I don't know how
 to tell the DMD or DSSS. I assumed that building the DWin library (in a
 subdirectory of DMD, of all places!) would immediately make it available.
 
 But I'm completely clueless and need some guidance.
 
 Thanks!
 
 --benji
I'm not in position to test DWin, but did you run dsss install at any point? Does DWin support it? When that is done, dsss will know without any further ado how to find it when compiling your application. Otherwise it is as with dmd, add -Ipathtodwinimports to your commandline, and similar for libraries and library paths. The actual arguments are processed in rebuild, so the helptext there should be of some help. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Aug 11 2008
parent reply Benji Smith <dlanguage benjismith.net> writes:
Lars Ivar Igesund wrote:
 I'm not in position to test DWin, but did you run dsss install at any point?
 Does DWin support it? When that is done, dsss will know without any further
 ado how to find it when compiling your application.
Boo yah! That's what I was forgetting. (BTW, the notion of installing a library is a very weird concept to me. It seems almost like... installing a text file.) So now, the DWin modules are successfully located by the compiler, but now I get this error message: regtest.d => regtest + D:\Development\d\libs\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ -ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib\ -ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib -oqdsss_objs\D regtest.d -ofregtest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. dsss_objs\D\_regtest.obj(_regtest) Error 42: Symbol Undefined _RegQueryValueExW 24 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegCloseKey 4 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegFlushKey 4 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegOpenKeyExW 20 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegCreateKeyExW 36 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegDeleteKeyW 8 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegDeleteValueW 8 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegQueryInfoKeyW 48 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegEnumKeyExW 32 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegEnumValueW 32 --- errorlevel 10 Command D:\Development\d\libs\dsss\bin\rebuild.exe returned with code -1, aborting. Error: Command failed, aborting.
Aug 11 2008
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Benji Smith wrote:

 Lars Ivar Igesund wrote:
 I'm not in position to test DWin, but did you run dsss install at any
 point? Does DWin support it? When that is done, dsss will know without
 any further ado how to find it when compiling your application.
Boo yah! That's what I was forgetting. (BTW, the notion of installing a library is a very weird concept to me. It seems almost like... installing a text file.) So now, the DWin modules are successfully located by the compiler, but now I get this error message: regtest.d => regtest + D:\Development\d\libs\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ -ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib\ -ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib -oqdsss_objs\D regtest.d -ofregtest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. dsss_objs\D\_regtest.obj(_regtest) Error 42: Symbol Undefined _RegQueryValueExW 24 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegCloseKey 4 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegFlushKey 4 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegOpenKeyExW 20 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegCreateKeyExW 36 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegDeleteKeyW 8 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegDeleteValueW 8 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegQueryInfoKeyW 48 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegEnumKeyExW 32 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegEnumValueW 32 --- errorlevel 10 Command D:\Development\d\libs\dsss\bin\rebuild.exe returned with code -1, aborting. Error: Command failed, aborting.
Hmm, maybe you need to link a specific win library for registry support? Sorry that I don't know though. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Aug 11 2008
parent reply "Koroskin Denis" <2korden gmail.com> writes:
On Mon, 11 Aug 2008 23:01:16 +0400, Lars Ivar Igesund  
<larsivar igesund.net> wrote:

 Benji Smith wrote:

 Lars Ivar Igesund wrote:
 I'm not in position to test DWin, but did you run dsss install at any
 point? Does DWin support it? When that is done, dsss will know without
 any further ado how to find it when compiling your application.
Boo yah! That's what I was forgetting. (BTW, the notion of installing a library is a very weird concept to me. It seems almost like... installing a text file.) So now, the DWin modules are successfully located by the compiler, but now I get this error message: regtest.d => regtest + D:\Development\d\libs\dsss\bin\rebuild.exe -Idsss_imports\ -I. -S.\ -ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib\ -ID:\Development\d\libs\dsss\include\d -SD:\Development\d\libs\dsss\lib -oqdsss_objs\D regtest.d -ofregtest OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. dsss_objs\D\_regtest.obj(_regtest) Error 42: Symbol Undefined _RegQueryValueExW 24 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegCloseKey 4 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegFlushKey 4 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegOpenKeyExW 20 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegCreateKeyExW 36 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegDeleteKeyW 8 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegDeleteValueW 8 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegQueryInfoKeyW 48 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegEnumKeyExW 32 D:\Development\d\libs\dsss\lib\\dwin.lib(Registry) Error 42: Symbol Undefined _RegEnumValueW 32 --- errorlevel 10 Command D:\Development\d\libs\dsss\bin\rebuild.exe returned with code -1, aborting. Error: Command failed, aborting.
Hmm, maybe you need to link a specific win library for registry support? Sorry that I don't know though.
It's advapi32.lib, located in /dm/lib (*not* /dmd/lib).
Aug 11 2008
parent reply Benji Smith <dlanguage benjismith.net> writes:
Koroskin Denis wrote:
 It's advapi32.lib, located in /dm/lib (*not* /dmd/lib).
Cool. Is there any way to express that dependency in the code, or do I need to use the -I switch to tell dsss to find the library there? Thanks! --benji
Aug 11 2008
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Benji Smith wrote:

 Koroskin Denis wrote:
 It's advapi32.lib, located in /dm/lib (*not* /dmd/lib).
Cool. Is there any way to express that dependency in the code, or do I need to use the -I switch to tell dsss to find the library there? Thanks! --benji
pragma(lib, "advapi32"); maybe? -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Aug 11 2008
parent Benji Smith <dlanguage benjismith.net> writes:
Lars Ivar Igesund wrote:
 Benji Smith wrote:
 
 Koroskin Denis wrote:
 It's advapi32.lib, located in /dm/lib (*not* /dmd/lib).
Cool. Is there any way to express that dependency in the code, or do I need to use the -I switch to tell dsss to find the library there? Thanks! --benji
pragma(lib, "advapi32"); maybe?
Thanks! That did the trick (once I realized that I hadn't downloaded the "dmc.zip" linker & utilities). --benji
Aug 11 2008