digitalmars.D.learn - Compiling dll issue.
- Taylor Hillegeist (24/24) Aug 25 2014 So i have been trying to follow the instructions on:
- Taylor Hillegeist (26/50) Aug 25 2014 So, I figured it out! I used the wrong example for mydll.def.
- fenom (9/33) Aug 25 2014 If you don't use the extern(C) foreign function interface then
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?
Aug 25 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!
Aug 25 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?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)
Aug 25 2014