Re: Compiling dll issue.

2014-08-25 Thread Taylor Hillegeist via Digitalmars-d-learn
On Monday, 25 August 2014 at 15:09:59 UTC, Taylor Hillegeist 
wrote:

So i have been trying to follow the instructions on:

http://wiki.dlang.org/Win32_DLLs_in_D

but when i get to the step where i compile the dll

dmd -ofmydll.dll -L/IMPLIB mydll.d dll.d mydll.def

I get this output:
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllGetClassObject
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllCanUnloadNow
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllRegisterServer
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllUnregisterServer

OPTLINK : Error 81: Cannot EXPORT : DllCanUnloadNow
OPTLINK : Error 81: Cannot EXPORT : DllGetClassObject
OPTLINK : Error 81: Cannot EXPORT : DllRegisterServer
OPTLINK : Error 81: Cannot EXPORT : DllUnregisterServer
--- errorlevel 8

Not, very pretty. Do I have something not setup right? Im using 
the latest DMD as of 8/25/2014. 2.066.0


Any Ideas?


So, I figured it out! I used the wrong example for mydll.def.

-
LIBRARY MYDLL
DESCRIPTION 'My DLL written in D'

EXETYPE NT
CODEPRELOAD DISCARDABLE
DATAWRITE

EXPORTS
DllGetClassObject   @2
DllCanUnloadNow @3
DllRegisterServer   @4
DllUnregisterServer @5
--
The above will cause errors: even though it makes you think that 
it should be mydll.def it is not.


--
LIBRARY mydll.dll
EXETYPE NT
SUBSYSTEM WINDOWS
CODE SHARED EXECUTE
DATA WRITE
--
The above is the correct .def contents

Thanks all!


Re: Compiling dll issue.

2014-08-25 Thread fenom via Digitalmars-d-learn
On Monday, 25 August 2014 at 15:09:59 UTC, Taylor Hillegeist 
wrote:

So i have been trying to follow the instructions on:

http://wiki.dlang.org/Win32_DLLs_in_D

but when i get to the step where i compile the dll

dmd -ofmydll.dll -L/IMPLIB mydll.d dll.d mydll.def

I get this output:
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllGetClassObject
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllCanUnloadNow
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllRegisterServer
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : 
DllUnregisterServer

OPTLINK : Error 81: Cannot EXPORT : DllCanUnloadNow
OPTLINK : Error 81: Cannot EXPORT : DllGetClassObject
OPTLINK : Error 81: Cannot EXPORT : DllRegisterServer
OPTLINK : Error 81: Cannot EXPORT : DllUnregisterServer
--- errorlevel 8

Not, very pretty. Do I have something not setup right? Im using 
the latest DMD as of 8/25/2014. 2.066.0


Any Ideas?


If you don't use the extern(C) foreign function interface then 
the name won't match to the export name as written in the source 
(in the binary you'll get the bytecount of all the param size 
with a @ before).
si you need to create a name table for optlink 
(http://www.digitalmars.com/ctg/ctgDefFiles.html)

(http://www.digitalmars.com/archives/cplusplus/4029.html)