creating plugins for c4d: section 1 addendum - compiling the SDK examples on a mac

Having successfully built the SDK example on a PC, I now wanted to build the example on a Mac. Being a complete Mac novice, this took quite a bit of work, including a lot of searching through the posts on Maxon's Plugin Cafe (where I was kind of relieved to see that I wasn't the only one to have such problems!).

Xcode 3

The first thing is that Xcode is very different from Visual Studio. Not surprising I guess, but add that to the differences between Windows and OSX, and it makes for an interesting experience.

Firstly, make sure you install the correct version of Xcode. Maxon recommends using OSX 10.5 (Leopard) for development; there do seem to have been some reported issues with using Snow Leopard (OSX 10.6). If you have Snow Leopard, you need Xcode 3.2.1 as at the time of writing, but you are on you own with that. If you're using Leopard, then Xcode 3.1.4 is the latest version. These tools can be downloaded from (You will need to create a free account if you don't have one.)

When you have downloaded the correct version, install it and make sure you install everything. Don't be tempted to omit some of the features to save disk space. I did that and Xcode wouldn't compile the SDK, giving more than 10,000 errors!

compiling the SDK

I have only done this with R10 and up, so I can't offer any help with versions older than that. The good thing is, it should just compile! Once you get Xcode installed properly, the SDK example will compile and produce the appropriate universal binary files (.dylib). One thing to be aware of which I didn't know is that if you are compiling under R10, you won't get a 64 bit version even if running on a 64 bit machine with a 64 bit OS, because with R10 64-bit C4D was only available for Windows. With R11, you can compile 64 bit versions but you do need at least OSX 10.5 (Leopard) and a 64 bit Mac.

What this means is that the compiled .dylib file sizes are very different for the SDK example under R10 and R11, because of the extra 64 bit binaries in the R11 version.

other issues

One issue is that of filenames. If you compile on a PC, and need to specify a path to a file, then the path delimiter is a backslash. However, on the Mac it is a forward slash. This won't cause compilation to fail, or give an error message, but it will cause the plugin not to work correctly. You need to correct this in the source code when compiled on a Mac.

Another issue can arise when compiling under R10 compared to under R11. Because there was no 64-bit version for R10, some variable types are not available. I wanted to use a variable type defined in the SDK as 'LULONG' which is basically a 64-bit unsigned long integer. This worked fine on the PC under R10 and R11, but only compiled under R11 on the Mac. This is not documented (as far as I can tell) in the SDK documentation, so be aware of this issue, which could conceivably arise with other variable types.

A third issue - again undocumented - is the difference between debug and release versions under R11 and R11.5. If you compile the debug version of the SDK example under R11, it will compile the 64-bit versions only. This is apparently to reduce compilation time. However, C4D R11 on the Mac starts by default in 32-bit mode, even if running on a 64-bit Mac with OSX 10.5 (which is 64-bit). This means that the compiled plugin won't show up in the C4D plugins menu. There are two solutions to this. First, you can compile the release version, which will compile both 32- and 64-bit versions of the plugin. Alternatively (a better solution) display 'Get Info' for the C4D executable and uncheck the run in 32-bit mode box. Then it will run in 64-bit mode and load the 64-bit version of the plugin.

R11.5 by contrast, is set by default to run in 64-bit mode. This can be really confusing if like me you are unfamiliar with Macs and don't know quite what's going on.

Other than these relatively minor issues, Xcode works pretty well and even Mac dunces like me can make it work!

Back to main tutorials page