View Full Version : compiling with Borland C++

06-09-2005, 04:51 PM
I'm using Borland C++ 5.6.4 (command line only) with LightWave 8.3 on Windows 2000. I've compiled a simple plugin that calls the info() function of a LWMessageFuncs struct. When I run it, I see the expected dialog box, but it is always followed by an error: "Custom operation failed. Plug-in Hello failed to start." This leads me to believe that LightWave is not getting the right return value.

I made two changes to servmain.c. I removed the Borland-specific conditional that changes the name of _mod_descrip to mod_descrip, and I exported it with __declspec(dllexport).

I compiled the plugin as an undecorated (-u-) cdecl (-pc) DLL (-tWD). The tdump utility shows that _mod_descrip is exported. Otherwise, LightWave wouldn't load it, at all.

06-16-2006, 12:07 AM
Ensure that the complier is set to generate underscores (default) - otherwise you can have other problems.

Note that for the benefit of the borland complier, servmain.c declares the module descriptor as:

mod_descrip (ie. no leading underscore)

This is on the assumption that the borland compiler will add a leading underscore (as it does by default).

Add serv.def to your project. This ensures that _mod_descrip is exported. Don't try exporting it by other means (declspec etc) or you'll end up in asymmetrical ****.

Not sure how you add the def file using the command line, but your docs should explain it.

Using C++ builder - see here:


06-16-2006, 12:36 AM
Oh, under C++ Builder, serv.def needs to have a name following LIBRARY - any name will do, eg.

LIBRARY pluginServer