|
Boost : |
From: Mattias Flodin (flodin_at_[hidden])
Date: 2004-07-24 20:29:00
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?
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.
* Not all mangling schemes are documented well or provide an API to
perform the mangling.
* Some (most likely insignificant) run-time and code-size overhead.
/Mattias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk