OptLink and D DLL creation

Daniel Giddings dgiddings at bigworldtech.com
Sun Feb 11 20:48:52 PST 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 at 16
> c:\dmd\lib\phobos.lib(monitor)
>  Error 42: Symbol Undefined _DeleteCriticalSection at 4
> c:\dmd\lib\phobos.lib(monitor)
>  Error 42: Symbol Undefined _LeaveCriticalSection at 4
> c:\dmd\lib\phobos.lib(monitor)
>  Error 42: Symbol Undefined _EnterCriticalSection at 4
> c:\dmd\lib\phobos.lib(monitor)
>  Error 42: Symbol Undefined _InitializeCriticalSection at 4
> c:\dm\bin\..\lib\SNN.lib(dllstart)
>  Error 42: Symbol Undefined _GetCurrentThreadId at 0
> c:\dm\bin\..\lib\SNN.lib(dllstart)
>  Error 42: Symbol Undefined _GetVersion at 0
> c:\dm\bin\..\lib\SNN.lib(cinit)
>  Error 42: Symbol Undefined _GetEnvironmentStrings at 0
> c:\dm\bin\..\lib\SNN.lib(cinit)
>  Error 42: Symbol Undefined _FreeEnvironmentStringsA at 4
> c:\dm\bin\..\lib\SNN.lib(ehsup)
>  Error 42: Symbol Undefined _RtlUnwind at 16
> c:\dm\bin\..\lib\SNN.lib(thsup)
>  Error 42: Symbol Undefined _CloseHandle at 4
> c:\dm\bin\..\lib\SNN.lib(semlock)
>  Error 42: Symbol Undefined _CreateSemaphoreA at 16
> c:\dm\bin\..\lib\SNN.lib(semlock)
>  Error 42: Symbol Undefined _ReleaseSemaphore at 12
> c:\dm\bin\..\lib\SNN.lib(semlock)
>  Error 42: Symbol Undefined _WaitForSingleObject at 8
> c:\dm\bin\..\lib\SNN.lib(semlock)
>  Error 42: Symbol Undefined _GetTickCount at 0
> c:\dm\bin\..\lib\SNN.lib(io)
>  Error 42: Symbol Undefined _GetStdHandle at 4
> c:\dm\bin\..\lib\SNN.lib(io)
>  Error 42: Symbol Undefined _SetHandleCount at 4
> c:\dm\bin\..\lib\SNN.lib(io)
>  Error 42: Symbol Undefined _DeleteFileA at 4
> c:\dm\bin\..\lib\SNN.lib(wctomb)
>  Error 42: Symbol Undefined _WideCharToMultiByte at 32
> c:\dm\bin\..\lib\SNN.lib(ISMBDIGI)
>  Error 42: Symbol Undefined _GetStringTypeA at 20
> c:\dm\bin\..\lib\SNN.lib(signal)
>  Error 42: Symbol Undefined _SetConsoleCtrlHandler at 8
> c:\dm\bin\..\lib\SNN.lib(_exit)
>  Error 42: Symbol Undefined _ExitProcess at 4
> c:\dm\bin\..\lib\SNN.lib(flush)
>  Error 42: Symbol Undefined _SetFilePointer at 16
> c:\dm\bin\..\lib\SNN.lib(setnterr)
>  Error 42: Symbol Undefined _GetLastError at 0
> c:\dm\bin\..\lib\SNN.lib(w32fater)
>  Error 42: Symbol Undefined _WriteConsoleA at 20
> c:\dm\bin\..\lib\SNN.lib(setmbcp)
>  Error 42: Symbol Undefined _GetACP at 0
> c:\dm\bin\..\lib\SNN.lib(setmbcp)
>  Error 42: Symbol Undefined _GetOEMCP at 0
> c:\dm\bin\..\lib\SNN.lib(setmbcp)
>  Error 42: Symbol Undefined _GetCPInfo at 8
> c:\dm\bin\..\lib\SNN.lib(except)
>  Error 42: Symbol Undefined _SetUnhandledExceptionFilter at 4
> c:\dm\bin\..\lib\SNN.lib(read)
>  Error 42: Symbol Undefined _ReadFile at 20
> c:\dm\bin\..\lib\SNN.lib(isatty)
>  Error 42: Symbol Undefined _GetFileType at 4
> c:\dm\bin\..\lib\SNN.lib(write)
>  Error 42: Symbol Undefined _GlobalFree at 4
> c:\dm\bin\..\lib\SNN.lib(write)
>  Error 42: Symbol Undefined _WriteFile at 20
> c:\dm\bin\..\lib\SNN.lib(write)
>  Error 42: Symbol Undefined _GlobalAlloc at 8
> c:\dm\bin\..\lib\SNN.lib(sbrk)
>  Error 42: Symbol Undefined _VirtualFree at 12
> c:\dm\bin\..\lib\SNN.lib(sbrk)
>  Error 42: Symbol Undefined _VirtualAlloc at 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]
> 


More information about the Digitalmars-d-learn mailing list