www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - The dll example doesn't seem to work

reply Lee <llee goucher.edu> writes:
I'm trying to write a dll using the example given in the manual.
Unfortunately, my application crashes when I try to execute it. I turned to
the example provided in the sample folder to see if I was making an error, but
when I tried to execute test.exe I got the same error.
Does anyone have any working examples describing the creation of dlls for the
win32 platform? Any help would be appreciated.
Jan 15 2007
parent Bradley Smith <digitalmars-com baysmith.com> writes:
The dmd\samples\d\mydll works for me. Below is the output for build.bat 
and test.exe. The implib tool is something people are often missing 
because it is a part of DMC not DMD. You can get it from DMC's Basic 
Utilities (http://ftp.digitalmars.com/bup.zip).

   Bradley


C:\dmd\samples\d\mydll>build.bat

C:\dmd\samples\d\mydll>..\..\..\bin\dmd -ofmydll.dll mydll2.d dll.d 
mydll.def
C:\dmd\bin\..\..\dm\bin\link.exe
mydll2+dll,mydll.dll,,user32+kernel32,mydll.def/noi;

C:\dmd\samples\d\mydll>implib/system mydll.lib mydll.dll
Digital Mars Import Library Manager Version 8.41n
Copyright (C) Digital Mars 2000-2004 All Rights Reserved, 
www.digitalmars.com
implib/h for help
Input is a Windows NT DLL file 'MYDLL.DLL'.
Output is a Windows NT import library.
Digital Mars Import Library Creator complete.

C:\dmd\samples\d\mydll>..\..\..\bin\dmd test.d mydll.lib
C:\dmd\bin\..\..\dm\bin\link.exe test,,,mydll.lib+user32+kernel32/noi;

C:\dmd\samples\d\mydll>test.exe
hello dll world

C:\dmd\samples\d\mydll>

Lee wrote:
 I'm trying to write a dll using the example given in the manual.
 Unfortunately, my application crashes when I try to execute it. I turned to
 the example provided in the sample folder to see if I was making an error, but
 when I tried to execute test.exe I got the same error.
 Does anyone have any working examples describing the creation of dlls for the
 win32 platform? Any help would be appreciated.

Jan 15 2007