RejectedSoftware Forums

Sign up

Dub and linking OSX frameworks

I am really struggling here with trying to use OSX Frameworks and dub. I want to build a simple app with portaudio and this requires the following frameworks: CoreAudio, AudioUnit, AudioToolbox, CoreServices, and Carbon.

I just seem not to be able to figure out how to pass the required arguments like "-L-framework Carbon" to gcc.

Can anybody enlighten this exhausted coder? ;)

Best
Chris

Re: Dub and linking OSX frameworks

On Sun, 13 Jul 2014 20:09:20 GMT, schneider wrote:

I am really struggling here with trying to use OSX Frameworks and dub. I want to build a simple app with portaudio and this requires the following frameworks: CoreAudio, AudioUnit, AudioToolbox, CoreServices, and Carbon.

I just seem not to be able to figure out how to pass the required arguments like "-L-framework Carbon" to gcc.

Can anybody enlighten this exhausted coder? ;)

Best
Chris

To pass a framework to DMD do this: dmd main.d -L-framework -LCarbon
To pass to GCC: gcc -framework Carbon
To pass to the linker: ld -framework Carbon

/Jacob Carlborg

Re: Dub and linking OSX frameworks

Thanks very much Jacob, like this I was already successful, directly invoking DMD, but my question is how can you do that using DUB as it seems to be an incredible handy tool to compile D programs. I was just struggling for a few hours getting DUB to pass the -framework switches on to GCC, I tried any possible combination. So far I was not peeking at the DUB source code, as I was figuring that it should be possible.

BTW, in the past I have already been successful using you fork of DMD and build a minimal Cocoa application. I hopefully will be able to contribute to the OSX toolchain for D soon.

Best and thanks again!

Re: Dub and linking OSX frameworks

On Mon, 14 Jul 2014 10:56:44 GMT, schneider wrote:

Thanks very much Jacob, like this I was already successful, directly invoking DMD, but my question is how can you do that using DUB as it seems to be an incredible handy tool to compile D programs. I was just struggling for a few hours getting DUB to pass the -framework switches on to GCC, I tried any possible combination. So far I was not peeking at the DUB source code, as I was figuring that it should be possible.

Try something like this:

"lflags-osx": ["-framework Carbon"]

Or two separate arguments:

"lflags-osx": ["-framework", "Carbon"]

BTW, in the past I have already been successful using you fork of DMD and build a minimal Cocoa application. I hopefully will be able to contribute to the OSX toolchain for D soon.

Cool :)

I'm pretty sure Dub has a "verbose" flag you can pass to see exactly how it invokes the compiler.

/Jacob Carlborg

Re: Dub and linking OSX frameworks

well that's some really good suggestions, thank you so much!

i tried the -v flag before but there was too much going on for someone like me ;) ttys jacob

chris

Re: Dub and linking OSX frameworks

Yes! Success:

"lflags-osx": ["-framework", "Carbon", "-framework", "CoreAudio", "-framework", "AudioToolbox", "-framework", "CoreServices", "-framework", "AudioUnit"],

the above makes portaudio compile and run in D using DUB!

thanks again

Re: Dub and linking OSX frameworks

On Mon, 14 Jul 2014 14:39:44 GMT, schneider wrote:

Yes! Success:

"lflags-osx": ["-framework", "Carbon", "-framework", "CoreAudio", "-framework", "AudioToolbox", "-framework", "CoreServices", "-framework", "AudioUnit"],

the above makes portaudio compile and run in D using DUB!

thanks again

No problem :)

/Jacob Carlborg