Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-07-26 00:54:51

Hi Mattias,
> On Fri, 23 Jul 2004 13:49:22 +0400, Vladimir Prus <ghost_at_[hidden]> wrote:
> > static imported_function<void()> apiFunc( "ApiFunc", "OSLib" );
> Couldn't find a nice point in the thread at which to insert this
> comment, so I'll just spit it out: Since we have both the name of the
> function and the function type, and given that a lib such as this
> should provide a platform-independent interface, would it be useful if
> the library automatically mangled the name according to the type?

I think you've missed something ;-) Even my initial reply inthe "additional
boost libraries" thread mentioned the possibility of calling functions which
are not "extern "C". At least two other persons seems to want this. I find
this would be nice, though not critical at all.

> Pros:
> * Type mismatches in arguments etc will be caught.
> * Possible to export multiple overloads of the same function name.
> * In the event that the imported library cannot be changed to use
> extern "C", it is still possible to import the function without
> resorting to platform-specific mangling in the function name string.
> Cons:
> * May cause problems if multiple mangling schemes exist on a single
> (OS) platform.

That's the case for gcc. Name mangling has changed in 3.x series. It should be
possible to work around, though, for example by mangling the name twice and
trying both mangled names.

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at