digitalmars.D.learn - OptLink and D DLL creation
- Derek Parnell (102/102) Feb 11 2007 I'm trying to get OptLink to create a DLL. Note: I'm not using DMD to
- Daniel Giddings (3/118) Feb 11 2007 They look to be from kernel32.lib. DMD looks to link against user32.lib,...
-
Derek Parnell
(8/10)
Feb 11 2007
Damn!
I knew that [... slips away without anyone else noticing ...]
I'm trying to get OptLink to create a DLL. Note: I'm not using DMD to invoke OptLink, but doing it myself. Using the D source file example found at http://www.digitalmars.com/d/dll.html#Dcode I can compile this using DMD quite ok. dmd -c mydll.d I then try this ... set LIB=c:\dmd\lib;c:\dm\lib link mydll.obj,mydll.dll,mydll.map,phobos.lib,mydll.def/noi/map where mydll.def looks like ... LIBRARY "mydll.dll" EXETYPE NT SUBSYSTEM WINDOWS,5.0 CODE PRELOAD DISCARDABLE SHARED EXECUTE DATA PRELOAD SINGLE WRITE And optlink spews forth ... c:\dmd\lib\phobos.lib(deh) Error 42: Symbol Undefined _RaiseException 16 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _DeleteCriticalSection 4 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _LeaveCriticalSection 4 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _EnterCriticalSection 4 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _InitializeCriticalSection 4 c:\dm\bin\..\lib\SNN.lib(dllstart) Error 42: Symbol Undefined _GetCurrentThreadId 0 c:\dm\bin\..\lib\SNN.lib(dllstart) Error 42: Symbol Undefined _GetVersion 0 c:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetEnvironmentStrings 0 c:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _FreeEnvironmentStringsA 4 c:\dm\bin\..\lib\SNN.lib(ehsup) Error 42: Symbol Undefined _RtlUnwind 16 c:\dm\bin\..\lib\SNN.lib(thsup) Error 42: Symbol Undefined _CloseHandle 4 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _CreateSemaphoreA 16 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _ReleaseSemaphore 12 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _WaitForSingleObject 8 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _GetTickCount 0 c:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _GetStdHandle 4 c:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _SetHandleCount 4 c:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _DeleteFileA 4 c:\dm\bin\..\lib\SNN.lib(wctomb) Error 42: Symbol Undefined _WideCharToMultiByte 32 c:\dm\bin\..\lib\SNN.lib(ISMBDIGI) Error 42: Symbol Undefined _GetStringTypeA 20 c:\dm\bin\..\lib\SNN.lib(signal) Error 42: Symbol Undefined _SetConsoleCtrlHandler 8 c:\dm\bin\..\lib\SNN.lib(_exit) Error 42: Symbol Undefined _ExitProcess 4 c:\dm\bin\..\lib\SNN.lib(flush) Error 42: Symbol Undefined _SetFilePointer 16 c:\dm\bin\..\lib\SNN.lib(setnterr) Error 42: Symbol Undefined _GetLastError 0 c:\dm\bin\..\lib\SNN.lib(w32fater) Error 42: Symbol Undefined _WriteConsoleA 20 c:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetACP 0 c:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetOEMCP 0 c:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetCPInfo 8 c:\dm\bin\..\lib\SNN.lib(except) Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4 c:\dm\bin\..\lib\SNN.lib(read) Error 42: Symbol Undefined _ReadFile 20 c:\dm\bin\..\lib\SNN.lib(isatty) Error 42: Symbol Undefined _GetFileType 4 c:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalFree 4 c:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _WriteFile 20 c:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalAlloc 8 c:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualFree 12 c:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 Now this looks a lot like another library or object file(s) is required to make it work. What is that? Or how do I call OptLink to make it happen. Note that just using dmd to do both compile and link steps works fine. dmd mydll.d mydll.def I want to do it in separate steps, so just humor me and assume that this is a valid request. [P.S. If you are going to quote this post in a reply, please remember to cut out all the original lines not relevant to the reply] -- Derek (skype: derek.j.parnell) Melbourne, Australia "Justice for David Hicks!" 12/02/2007 3:24:10 PM
Feb 11 2007
They look to be from kernel32.lib. DMD looks to link against user32.lib, and kernel32.lib by default. There are copies of them in \dm\lib. Derek Parnell wrote:I'm trying to get OptLink to create a DLL. Note: I'm not using DMD to invoke OptLink, but doing it myself. Using the D source file example found at http://www.digitalmars.com/d/dll.html#Dcode I can compile this using DMD quite ok. dmd -c mydll.d I then try this ... set LIB=c:\dmd\lib;c:\dm\lib link mydll.obj,mydll.dll,mydll.map,phobos.lib,mydll.def/noi/map where mydll.def looks like ... LIBRARY "mydll.dll" EXETYPE NT SUBSYSTEM WINDOWS,5.0 CODE PRELOAD DISCARDABLE SHARED EXECUTE DATA PRELOAD SINGLE WRITE And optlink spews forth ... c:\dmd\lib\phobos.lib(deh) Error 42: Symbol Undefined _RaiseException 16 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _DeleteCriticalSection 4 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _LeaveCriticalSection 4 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _EnterCriticalSection 4 c:\dmd\lib\phobos.lib(monitor) Error 42: Symbol Undefined _InitializeCriticalSection 4 c:\dm\bin\..\lib\SNN.lib(dllstart) Error 42: Symbol Undefined _GetCurrentThreadId 0 c:\dm\bin\..\lib\SNN.lib(dllstart) Error 42: Symbol Undefined _GetVersion 0 c:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetEnvironmentStrings 0 c:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _FreeEnvironmentStringsA 4 c:\dm\bin\..\lib\SNN.lib(ehsup) Error 42: Symbol Undefined _RtlUnwind 16 c:\dm\bin\..\lib\SNN.lib(thsup) Error 42: Symbol Undefined _CloseHandle 4 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _CreateSemaphoreA 16 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _ReleaseSemaphore 12 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _WaitForSingleObject 8 c:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _GetTickCount 0 c:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _GetStdHandle 4 c:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _SetHandleCount 4 c:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _DeleteFileA 4 c:\dm\bin\..\lib\SNN.lib(wctomb) Error 42: Symbol Undefined _WideCharToMultiByte 32 c:\dm\bin\..\lib\SNN.lib(ISMBDIGI) Error 42: Symbol Undefined _GetStringTypeA 20 c:\dm\bin\..\lib\SNN.lib(signal) Error 42: Symbol Undefined _SetConsoleCtrlHandler 8 c:\dm\bin\..\lib\SNN.lib(_exit) Error 42: Symbol Undefined _ExitProcess 4 c:\dm\bin\..\lib\SNN.lib(flush) Error 42: Symbol Undefined _SetFilePointer 16 c:\dm\bin\..\lib\SNN.lib(setnterr) Error 42: Symbol Undefined _GetLastError 0 c:\dm\bin\..\lib\SNN.lib(w32fater) Error 42: Symbol Undefined _WriteConsoleA 20 c:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetACP 0 c:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetOEMCP 0 c:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetCPInfo 8 c:\dm\bin\..\lib\SNN.lib(except) Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4 c:\dm\bin\..\lib\SNN.lib(read) Error 42: Symbol Undefined _ReadFile 20 c:\dm\bin\..\lib\SNN.lib(isatty) Error 42: Symbol Undefined _GetFileType 4 c:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalFree 4 c:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _WriteFile 20 c:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalAlloc 8 c:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualFree 12 c:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 Now this looks a lot like another library or object file(s) is required to make it work. What is that? Or how do I call OptLink to make it happen. Note that just using dmd to do both compile and link steps works fine. dmd mydll.d mydll.def I want to do it in separate steps, so just humor me and assume that this is a valid request. [P.S. If you are going to quote this post in a reply, please remember to cut out all the original lines not relevant to the reply]
Feb 11 2007
On Mon, 12 Feb 2007 15:48:52 +1100, Daniel Giddings wrote:They look to be from kernel32.lib. DMD looks to link against user32.lib, and kernel32.lib by default. There are copies of them in \dm\lib.Damn! <G> I knew that [... slips away without anyone else noticing ...] -- Derek (skype: derek.j.parnell) Melbourne, Australia "Justice for David Hicks!" 12/02/2007 3:53:38 PM
Feb 11 2007