Compiling dll issue.

Taylor Hillegeist via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 25 08:16:58 PDT 2014


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
CODE            PRELOAD DISCARDABLE
DATA            WRITE

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!


More information about the Digitalmars-d-learn mailing list