|
Boost Users : |
From: Paul (elegant_dice_at_[hidden])
Date: 2005-08-25 05:21:47
Hi all,
It seems that theres a lot of traffic in regards to using filesystem as
a DLL with mingw (or other) compilers. I'd like to lay out what I know
and try and figure out a solution for it. Or at least ask for a
work-around to be added to the CVS, or to the documentation!
Often I see complaints that it will fail to work as expected! This is
because the 'native' "flag" passed to path will be virtually IGNORED
when you link to it as a DLL.
Why? Because native is not a flag, its a free function pointer. Inside
the filesystem DLL, it compares the address of the passed checker
against its version of 'native', however: the address of 'native' is
DIFFERENT in the DLL compared with any other DLL or your executable!
So native(you) != native(DLL), so paths will be checked the POSIX way,
not the native way.
I've heard suggestions that you should define BOOST_ALL_DYN_LINK,
however that doesn't seem to do anything in my case. I've tested it. I
am betting that most people 'solve' it by statically linking to it, but
thats not an option for me.
The only solution I have come up with is to add a function to get the
DLL's native function address. Instead of passing 'native', I now pass
get_native(). This just does return native; but it does it inside the
DLL, so you get the "right" function address.
Beman said that it should be fixed in the next version of filesystem,
however it appears to be Not Hear Yet. So can we please please get an
interim fix?
Attached was my attempt from back in January, it worked for me, and I'll
be applying it to my shiny new 1.33 version.
Thanks
Paul
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net