3 ms·
The OS X platform code for Firefox is written in Objective-C++. It's not without issues, but overall it's a nice way to use Objective-C from within a larger C++
by jaas 4y ago
The OS X platform code for Firefox is written in Objective-C++. It's not without issues, but overall it's a nice way to use Objective-C from within a larger C++ code base. I didn't find it difficult to work with, particularly as opposed to what we'd have to do if Objective-C++ didn't exist.
If you want to see what this looks like, look at the .mm files here:
https://github.com/mozilla/gecko-dev/tree/master/widget/cocoa https://github.com/mozilla/gecko-dev/tree/master/widget/coco...
If you want a specific file to look at with good examples of how this works, here's one:
https://github.com/mozilla/gecko-dev/blob/master/widget/cocoa/nsChildView.mm https://github.com/mozilla/gecko-dev/blob/master/widget/coco...
Basically what you're looking for is being able to make Obj-C calls (e.g. [[ChildView alloc] initWithFrame:r geckoChild:this]) from within what is otherwise normal C++, and vice-versa.