3D CyberCorp Tutorials
Home Tutorials Lightwave Plugi...
Search : 

Lightwave Plugin Compilation on Mac

This tutorial explains how to compile a C/C++ plugin for Lightwave on the Macintosh without using CodeWarrior, just freely available software. I have highlighted issues you may encounter and work arounds. These instructions should work in either Mac OS9 or OSX using Classic, although they have only been tried in OSX using Classic. I have only built this on a PowerPC based system, and do not know if it can be done on an Intel based Mac system. If you require any additional help, or would like me try porting your plugin simply email me.

Instructions
  1. First download the MPW installation from the Apple Developers site http://developer.apple.com/tools/mpw-tools/ and install.
  2. After installing MPW, download all the updates from http://developer.apple.com/tools/mpw-tools/updates.html and install them. Installing these was a matter of overwriting the existing files where MPW was originally installed.
  3. Next install the Lightwave SDK of choice somewhere appropriate.
  4. First you must compile the server library, follow these steps to do that. If at any time you run into problems refer to the notes section at the bottom for further help.
    1. Launch MPW Shell
    2. Then from the menus select "Directory" -> "Set Directory..." and then choose the "source" folder under the SDK installation.
    3. Then from the menus select "Build" -> "Create Build Commands...".
    4. Next enter the program name as "server.lib" and select "Static Library" and "PowerPC Only".
    5. Then click "Source Files..." and choose "servdesc.c", "username.c", "startup.c", and "shutdown.c" and then click "Add" then "Done".
    6. Then click "Include Search Paths..." and choose the "include" folder under the SDK installation and then click "Add" then "Done".
    7. Then click "PowerPC Options..." and then in the "C Options" box enter "-d _MACOS -d _PPC_" and then click "Continue".
    8. Now click "CreateMake" and this should then write a makefile you can use to build "server.lib" with. You should not get any popup messages, if you do then retry these steps again.
    9. Then from the menus select "Build" -> "Build...". At this point the program name should already be filled in with "server.lib", but if not or if you come back to build it again, fill it in. Then click "OK". It should now build the library, and in the main "Worksheet" window you should see a trace of the build with the last line ending with "Done". If the last line does not end with "Done" then something went wrong with the build process, and you should check the rest of the trace for the reason.
    10. This concludes building the "server.lib" file, which you should now find in the "source" folder called "server.lib.o".
  5. The next is to build your plugin by doing the following steps.
    1. First create a folder containing your source files for your plugin.
    2. Then from the menus select "Directory" -> "Set Directory..." and then choose the folder with your source files.
    3. Then from the menus select "Build" -> "Create Build Commands...".
    4. Next enter your plugins name for the program name making sure it ends with ".p".
    5. Next select "Shared Library" and "PowerPC Only".
    6. Then click "Source Files..." and choose "servmain.c" from the "source" folder under the SDK installation and then click "Add". Change the "Show" option to "All files" and choose and "server.lib.o" and then click "Add".
    7. Change the "Show" option back to "'TEXT' files only" and then choose all the source files (.c and .cp, not .h) for your plugin, and then click "Add" then "Done".
    8. Then click "Include Search Paths..." and choose the "include" folder under the SDK installation and then click "Add" then "Done".
    9. At this point you may need to click "Additional Libraries..." and choose any other libraries you require (for my plugins I did not need anything extra).
    10. Then click "PowerPC Options..." and then in the "C Options" box enter "-d _MACOS -d _PPC_" and if you have C++ source in the "C++ Options" box enter "-d _MACOS -d _PPC -bool on". This sets the right definitions and also enables the use of the "bool" keyword in C++ code. Then click "Continue".
    11. You must disable both the entry/startup and exit/shutdown points of the shared library otherwise it will fail to load in Lightwave. In the "Link Options" box enter "-init none -term none" and then click "Continue".
    12. Then click on "Exported Symbols..." and enter "_mod_descrip" then click "Continue".
    13. Now click "CreateMake" and this should then write a makefile you can use to build your plugin with. You should not get any popup messages, if you do then retry these steps again.
    14. Then from the menus select "Build" -> "Build...". At this point the program name should already be filled in with your plugins name, but if not or if you come back to build it again, fill it in. Then click "OK". It should now build your plugin, and in the main "Worksheet" window you should see a trace of the build with the last line ending with "Done". If the last line does not end with "Done" then something went wrong with the build process, and you should check the rest of the trace for the reason. You may want to check the trace anyway for possible problems regarding warnings etc.
    15. This concludes building your plugin file, which you should now find in the folder you created for it.

Notes - Some other hints you might find useful:

Designed for "Internet Explorer 5.0" / "Firefox 1.0" / "Netscape 4.6" / "Opera 7.5" and above
Last Updated 14th April 2006
Copyright © 2001-2006 3DCyberCorp by Antony Scerri