xfbuild, optlink and pragma(lib)

Mike Parker aldacron at gmail.com
Sun Aug 1 04:50:55 PDT 2010


Mafi wrote:

> 
> When I comment out the pragma(lib) optlink fails (correctly) and xfbuild 
> crashes (:-(). Then I call optlink myself with libsdl.dll.a and it 
> creates a corrupt exe without errormessages.
> 
> Please help me. It seems that there are bugs over bugs. I don't konw 
> what to do.
> 
> I use Windows 7, dmd (2.047), xfbuild with cmd/powershell.

libSDL.dll.a is a MingW- or Cygwin-compiled link library. That's not 
going to work on Windows with DMD and may very likely be the source of 
your problem. If you want to link with a DLL link lib, then you need to 
get the tool coff2omf[1] (part of the Extended Utilities Package[2]) run 
it on SDL.lib (I suppose it might work on SDL.dll.a), and link with the 
resulting converted file. Either that or compile SDL with DMC.

Alternatively, you could modify your binding to load SDL dynamically 
like Derelict does. Then you don't need to fool around with any link 
libs. But, you do need a fair amount of implementation code to load the 
function symbols from the DLL.

[1] http://www.digitalmars.com/ctg/coff2omf.html
[2] http://www.digitalmars.com/download/freecompiler.html


More information about the Digitalmars-d-learn mailing list