Building Plugins with Cygwin

From X-Plane SDK
Jump to: navigation, search

This procedure is for one of the examples floating around... oh, one caveat. I'm still using SDKb4, so there is a small, small chance that this doesn't work. Let me know.

1. Edit XPLMDefs.h and copy all of the IBM declarations for PLUGIN_API and call it CYGWIN. This is overkill perhaps, but you don't want the <windows.h> include.

2. Compile the C or C++ code into an object file.

gcc/g++ -c Camera.c/.cpp -I$SDKHOME/Headers/XPLM \
-I$SDKHOME/Headers/Widgets

3. Build the dll (making sure that the objects are referenced on the command line in the 'right' order)

gcc/g++ -Wl -shared -o Camera.dll Camera.o \
-L$SDKHOME/Libraries/Win -lXPLM -lXPWidgets -lglut32 \
-lglu32 -lopengl32 -mwindows

(NB: I don't think the -mwindows is actually needed unless you do something odd like try to use the serial port with Win32 calls)

4. Copy Camera.dll to $XSYSTEM_HOME/Resources/plugins/Camera.xpl