|
From: | Marcus G. Daniels |
Subject: | Re: [Swarm-Support] compile with objective-c++ |
Date: | Sun, 04 Mar 2007 18:54:55 -0700 |
User-agent: | Thunderbird 1.5.0.9 (X11/20070212) |
Gennady Telegin wrote:
is it possible to compile Swarm with Objective-C++?I took a look at this. Basically I just tried your (apparent) approach with heatbugs. That is, to use an ordinary build of Swarm (without Objective C++), but build the simulation itself using the new compiler. There's no real reason this shouldn't work, besides the things we discussed, and no penalty I can think of for not rebuilding Swarm itself using the C++ compiler.
Anyway, I made a handful of changes that at least get me a working heatbugs and mousetrap using:
make OBJC='gcc -x objective-c++' (an alternative to renaming the files to .mm)The changes were nothing more than removing use of C++ reserved words from Swarm headers (e.g. "class" and "bool") and adding C++ extern "C" for those functions that are public parts of the Swarm API (e.g. initSwarm, serialization functions, probe creation functions).
For those not familiar with Objective C++, the idea is that Objective C and C++ classes are completely orthogonal, so that performance-critical functions can be C++ classes and objects requiring more dynamism can be Objective C.
Thanks for the suggestion, Gennady. Let me know if you have problems with your model. I didn't test any farther than to ensure existing Objective C models could be recompiled with Objective C++ -- I didn't try embedding C++ classes, but I'd be rather astonished if it didn't work.
The changes are checked into the Swarm Savannah CVS repository. I used Fedora 7t2, not Debian, so some tweaks may still be needed.
Marcus
[Prev in Thread] | Current Thread | [Next in Thread] |