On 2017-11-24 16:09, Adam D. Ruppe wrote:

Thanks, this gets me started.

Do you happen to know if there is anything like "pragma(lib)" for the -framework argument? (I don't use dub, so I took your config there to make my own command line, but it would be nice if I didn't have to specify the framework. I use pragma(lib) on Windows and Linux so infer it automatically.)

There's not [1].

So my plan here is to get more of my libs working on Mac: update the old simpledisplay.d port so it runs on the native api again (currently it just uses XQuartz),

I think you should start by deciding if you want to use any .nib files or not. If you do use .nib files there is quite a lot of code that can be removed from my sample application.

then make my simpleaudio.d use OpenAL which I hear has been included with the mac os for some time

Yes, it's included. Apple has several audio frameworks [2], where OpenAL is one of them, for different purposes and different levels.

, then maybe even move on to minigui.d and have it use some native controls too, if reasonable But the first step is just creating a basic window and your code worked, so thanks, I am on the path now...

BTW, the following line [3] of the Dub file will embed the Info.plist file in the executable, which can be handy if you don't want to use application bundles. The Info.plist file is not always necessary, I think my sample application will work without it, but for some things is necessary.

I also have a Dockerfile [4] with a cross-compiler setup that targets macOS.

You should also know that there's a bug in DMD, which I haven't manged to fix, that occurs when returning certain structs from Objective-C methods. I'm pretty sure if works correctly in LDC, since it's using the LLVM backend that already knows about Objective-C.

Finally, since you're using D you'll not have ARC (Automatic Reference Counting) which these days are preformed by the Objective-C and Swift compilers. You'll need to resort to traditional release/retain calls where appropriate. I have not included those calls in my sample application.

If you decide to use DStep, please file bugs and let me know how it works. It has not been battle tested for Objective-C code.

[1] https://issues.dlang.org/show_bug.cgi?id=2968

[2] https://developer.apple.com/library/content/documentation/MusicAudio/Conceptual/CoreAudioOverview/CoreAudioFrameworks/CoreAudioFrameworks.html

[3] https://github.com/jacob-carlborg/d_webkit_test/blob/master/dub.sdl#L12

[4] https://github.com/jacob-carlborg/docker-ldc-darwin/blob/master/Dockerfile

--
/Jacob Carlborg

Reply via email to