xfbuild, optlink and pragma(lib)

Mafi mafi at example.org
Fri Jul 30 10:50:43 PDT 2010


Hi,
I wanted to create an simple wrapper around SDL. After my simple first 
steps, I wanted to create a simple application using my wrapper. That's it:
///////
module test;

import std.stdio;
import mysdl.system;

//pragma(lib,r"Path\to\SDL\lib\libSDLmain.a");
pragma(lib,r"Path\to\SDL\lib\libSDL.dll.a");


void main() {
   initAll(); //Init all SDL-subsystems
}
////////
I tried to compile it using
xfbuild test.d +full +xstd +xcore -debug -I.. +v +o=test
(-I.. -> there is mysdl)
That doesn't work! It doesn't create any executable but there's no 
error. Because xfbuild -v doesn't show the linker-command either I tried 
to reproduce it myself. It seems that optlink is the problem because it 
does nothing but shows no errormessages.

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.

PS: I know there's Derelict but wanted to create this myself as a task 
for learning D.


More information about the Digitalmars-d-learn mailing list