
Vladimir Prus <ghost <at> cs.msu.su> writes:
Probably, you could start by explaining your vision of the library first. Of three points you've given:
The problems I would like to solve for myself are: 1) Often you need to write progams that need to work on different versions of a particular OS, with later versions having additional API calls that you could use. You end up writing stubs for those functions that at runtime check the availability of the API function, use it if it's available or do something different when it's not. It would be nice if it could be coded like so: void MyAPIStub() { static imported_function<void()> apiFunc( "ApiFunc", "OSLib" ); if ( !apiFunc ) { // do something here } apiFunc(); } Altough I acknowlege that the locking required in multi-threaded progams would clutter the syntax (more than) a little. 2) When creating plugin interfaces, having to go through extern "C" is a bit ugly to me. At the same time it ditches the C++ type safety. Being able to export a C++ plugin function and have the import library figure out the name mangling for me would improve the both the readability and the correctness of the program
* a simple interface to load a library by name or path and query the address of symbols by name * a boost::function-like type that can bind to a function at runtime and call it * a scoped_ptr or smart_ptr-like type that can bind to exported PODs at runtime
The two last seems very vague for me. For example, how the second is different from:
boost::function<void (void)> f = static_cast<void (*void)>dlsym(h, "whatever")
- Volodya
Yeah, yesterday morning I was already thinking more of something like this boost::function<void()> f1 = import<void()>( "lib", "whatever" ); boost::function<void()> f2 = import<void()>( lib, "whatever" ); boost::function<void()> f3 = import<void()>( lib, "whatever", some_decorator () ); As far as the cdecl decorator and the tool is concerned. I have always considered it very likely that I would fail and not achieve what I want, but that won't stop me from trying. Svenne