Boost logo

Boost :

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


Reece Dunn wrote:

> Would it be possible to have a mangle function, then you could do
> something like:
>
> static imported_function<void()> apiFunc( mangle::mwcw( "ApiFunc" ),
> "OSLib" );
>
> This would mean that imported_function need only know how to get the
> function (e.g. using GetProcAddress in Win32) and not worry about the name
> mangling scheme used.

I though more about a policy function/class. Something like:

   boost::dll my_dll("foo", cpp_mangler);
   boost::dll my_dll2("foo", c_mangler);

> The name mangling could then be handled by a
> mangler/demangler library that would be useful in diagnostics, e.g.:
>
> template< typename T >
> inline void print_type( const T & t )
> {
> std::cout << demangle::gcc3( typeid(t).name());
> }

That's for sure. And in other contexts too.

> Also, wouldn't it be better to have import as a function of
> shared_library, so you could do something like:
>
> boost::shared_library mylib( "user32.dll" )
> typedef ... msgboxA_fn;
>
> msgboxA_fn mbA = mylib.import< msgboxA_fn >( "MessageBoxA" );
> msgboxW_fn mbW = mylib.import< msgboxW_fn >( "MessageBoxW" );

Hmm... I've made the same remark in reply to Sven. The syntax is up for
discussion, though.

I also wonder if it makes sense to sumbit just "dll" library, or some
additional plugin support need to be developed first.

- Volodya


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