Boost logo

Boost :

From: Jeremy Pack (rostovpack_at_[hidden])
Date: 2008-07-28 14:13:07


Noah,

On Mon, Jul 28, 2008 at 10:48 AM, Noah Roberts <roberts.noah_at_[hidden]>wrote:

> Does this library address the problems associated with calling conventions
> when using different compilers? Can I compile an application with one
> compiler and allow users to provide plugins compiled with another?
>
> I have my doubts that this is even possible to solve, but I ask anyway.
>

No, not really. And it's much worse than just the difference between calling
conventions.

The issue is that C++ classes (and other things...) can be of different
formats when compiled by different compilers, or even different compiler
settings. For this reason, if you want to develop plugins that can be
compiled by different compilers safely, you should probably stick to
functions that pass around simple types (int, float, const char* etc.).

Since one can't pass around classes safely, this means no reflection, no
factories, no shared objects etc. Since these are what Extension is designed
for, I'd recommend another solution. Though you can use the shared_library
class in Boost.Extension for this, you really won't get the library's full
benefit.

What you could do is run the plugin in a separate process, and use
inter-process communication, and serialize data between them. Then calling
conventions wouldn't matter. It would certainly be a lot more complicated
though.

It's a good question though, and I'll add it to the FAQ.

Jeremy Pack
http://boost-extension.blogspot.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk