www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - win32 build error

reply akcom <CppCoder gmail.com> writes:
wchar []ModuleFileName( HMODULE Module )
{
	wchar []Result;
	
	Result.length = 256;
	//Result.length = GetModuleFileNameW( Module, cast( wchar * )Result,
Result.length ) / wchar.sizeof;
	
	
	return Result;
}

when the commented line remains commented, the application compiles
file, but when the line is uncommented, i receive a plethora of errors
upon building:
C:\dmd\src\phobos\std\c\windows\windows.d(371): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(371): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(371): cannot have parameter of
type void
C:\dmd\src\phobos\std\c\windows\windows.d(398): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(398): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(399): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(399): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(399): cannot have parameter of
type void
C:\dmd\src\phobos\std\c\windows\windows.d(401): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(401): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(401): cannot have parameter of
type void
C:\dmd\src\phobos\std\c\windows\windows.d(402): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(402): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(402): cannot have parameter of
type void
C:\dmd\src\phobos\std\c\windows\windows.d(403): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(403): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(403): cannot have parameter of
type void
C:\dmd\src\phobos\std\c\windows\windows.d(1918): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(1918): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(2620): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(2620): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(2620): cannot have parameter
of type void
C:\dmd\src\phobos\std\c\windows\windows.d(2621): identifier 'HMODULE' is
not defined
C:\dmd\src\phobos\std\c\windows\windows.d(2621): HMODULE is used as a type
C:\dmd\src\phobos\std\c\windows\windows.d(2621): cannot have parameter
of type void
console_main.d(32): identifier 'HMODULE' is not defined
console_main.d(32): HMODULE is used as a type
console_main.d(32): cannot have parameter of type void

any ideas?
Dec 13 2005
parent reply David L. Davis <SpottedTiger yahoo.com> writes:
In article <dno5bs$2tl4$1 digitaldaemon.com>, akcom says...
wchar []ModuleFileName( HMODULE Module )
{
	wchar []Result;
	
	Result.length = 256;
	//Result.length = GetModuleFileNameW( Module, cast( wchar * )Result,
Result.length ) / wchar.sizeof;
	
	
	return Result;
}

when the commented line remains commented, the application compiles
file, but when the line is uncommented, i receive a plethora of errors
akcom, this code works: )); Output: ------- C:\dmd>dmd winapi1.d C:\dmd\bin\..\..\dm\bin\link.exe winapi1,,,user32+kernel32/noi; C:\dmd>winapi1 Module filename="C:\dmd\winapi1.exe" C:\dmd> David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Dec 14 2005
parent reply Derek Parnell <derek psych.ward> writes:
On Thu, 15 Dec 2005 03:30:56 +0000 (UTC), David L. Davis wrote:

 akcom, this code works:
[snip] and so does this ... module test; import std.stdio; int main(char[][] pArgs) { writefln("Module filename=\"%s\"", pArgs[0]); return 0; } OUTPUT:::::::: c:\temp>build test -run Path and Version : y:\util\build.exe v2.9(1197) built on Wed Aug 10 11:03:42 2005 y:\dmd\bin\..\..\dm\bin\link.exe test,test.exe,,user32+kernel32,test.def/noi; Module filename="c:\temp\test.exe" -- Derek (skype: derek.j.parnell) Melbourne, Australia "A learning experience is one of those things that says, 'You know that thing you just did? Don't do that.'" - D.N. Adams 15/12/2005 2:34:49 PM
Dec 14 2005
parent "Regan Heath" <regan netwin.co.nz> writes:
On Thu, 15 Dec 2005 14:41:21 +1100, Derek Parnell <derek psych.ward> wrote:
 On Thu, 15 Dec 2005 03:30:56 +0000 (UTC), David L. Davis wrote:

 akcom, this code works:
[snip] and so does this ... module test; import std.stdio; int main(char[][] pArgs) { writefln("Module filename=\"%s\"", pArgs[0]); return 0; } OUTPUT:::::::: c:\temp>build test -run Path and Version : y:\util\build.exe v2.9(1197) built on Wed Aug 10 11:03:42 2005 y:\dmd\bin\..\..\dm\bin\link.exe test,test.exe,,user32+kernel32,test.def/noi; Module filename="c:\temp\test.exe"
IIRC there isn't a guarantee that the first arg is your executable name. Granted most (maybe all existing) prompts/shells define it so, but I suspect it's a habit as opposed to a guarantee. For example you can write an app which executes the above binary using 'execve' and does not assign the executable filename to the first arg. Regan
Dec 14 2005