|
Boost : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-02-25 00:49:46
> > I think Gennadiy wants the dll code to call a user-defined function,
> > and the problem is that if you declare the function and then leave it
> > undefined the linker complains, even though this works fine with
> > static linking, since the user supplies the definition and the linker
> > sees everything at once.
>
> OK, but would it not be better just to use boost::function<> to allow the
> user to pass in a user-defined function at run-time from wherever he
chooses
> ? This is much more flexible than attempting to declare a user-defined
> function in a Dll which the end-user is supposed to define and depend on
> compile/link to resolve it..
Flexibility point aside this is the way static version is working. I just
looking for solution to do the same with dll.
As for callback based interface (another thing is that I couldn't depend on
boost::function) your proposition would complicate users interface: one need
not only define the init function itself but she also has to write main
function itself that invoke the framework and pass this callback (or another
function I would call from main myself but this would be catch-22)
Gennadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk