If I understand things correct dmd uses gcc to do the linking on linux
and osx, therefore I should be able to link against frameworks on osx.
GDC/GCC uses the compiler flag "-framework Carbon" and the passes the
same flag to the linker. LDC/LLVM uses the linker flag
"-framework=Carbon" which I can pass to the linker using "-L". But I
can't figure out how to do that with DMD.
The problem is if compile like this for example: "dmd -L-framework
Carbon main.d" dmd complains that it can't find Carbon.d. It seems that
it takes everything as a D source file if it doesn't recognize it as a
compiler switch.

The problem is if compile like this for example: "dmd -L-framework
Carbon main.d" dmd complains that it can't find Carbon.d. It seems that
it takes everything as a D source file if it doesn't recognize it as a
compiler switch.

The problem is if compile like this for example: "dmd -L-framework
Carbon main.d" dmd complains that it can't find Carbon.d. It seems
that it takes everything as a D source file if it doesn't recognize it
as a compiler switch.

Seems it needs the -L flag on each: dmd -L-framework -LCarbon main.d
Because -Xlinker is being used, "-Wl,-framework,Carbon" doesn't work.

to use different commands for this.

Yeah, it's somewhat annoying. Versions have the same problem, too:
dmd -version=foo
gdc -fversion=foo
ldc -d-version=foo
Of course one can use a build tool or development environment to add
those, or use the gdmd and ldmd wrappers which might not work for libs.
(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")
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"); }
--anders

Seems it needs the -L flag on each: dmd -L-framework -LCarbon main.d
Because -Xlinker is being used, "-Wl,-framework,Carbon" doesn't work.

have to use different commands for this.

Yeah, it's somewhat annoying. Versions have the same problem, too:
dmd -version=foo
gdc -fversion=foo
ldc -d-version=foo
Of course one can use a build tool or development environment to add
those, or use the gdmd and ldmd wrappers which might not work for libs.
(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.

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"); }
--anders

I didn't know you could do that. It would be nice if the built in
pragma(lib, ""); would work like pragma(link, "");

(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

If I understand things correct dmd uses gcc to do the linking on linux and
osx, therefore I should be able to link against frameworks on osx.
GDC/GCC uses the compiler flag "-framework Carbon" and the passes the same
flag to the linker. LDC/LLVM uses the linker flag "-framework=Carbon" which
I can pass to the linker using "-L". But I can't figure out how to do that
with DMD.
The problem is if compile like this for example: "dmd -L-framework Carbon
main.d" dmd complains that it can't find Carbon.d. It seems that it takes
everything as a D source file if it doesn't recognize it as a compiler
switch.