DMD Mac and linking with frameworks

Anders F Björklund afb at algonet.se
Sun Mar 15 07:36:30 PDT 2009


Jacob Carlborg wrote:

>> (it would however be nice if DMD for Mac OS X could be taught to accept
>> the most straightforward syntax for it, i.e. "dmd -framework Carbon")
> 
> I asked that ldc should add this but they said something about a linker 
> flag shouldn't be available as a compiler flag.

I guess that prefixing -L to the linker flags is the way to go then.

>> The most intriguing part was trying to link frameworks with "pragma",
>> where the build tool will automatically add a friendly "-l" for you...
>> The workaround is to include a library that is always available/used,
>> and then append the real framework linker flags after that library:
>>
>> version (build) { pragma(link, "System -framework Carbon"); }
> 
> I didn't know you could do that. It would be nice if the built in 
> pragma(lib, ""); would work like pragma(link, "");

Me neither, it was more of a desperate attempt to try to convert the
wx-config --libs into something that bud/build could make use of...
Naturally it failed anyway, due to some weird linking order issues,
but at least it tried - and wx.libs looks reasonable enough to me.

Don't think pragma(lib) ever worked here, but saw it in D 1.037
Think it was http://d.puremagic.com/issues/show_bug.cgi?id=1690

--anders



More information about the Digitalmars-d mailing list