New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenSlide crashes when used in third-party application including boost/thread/future.hpp #124
Comments
Update: this also happens with VC9 (Visual Studio 2008) |
So adding/removing the I don't have an explanation, but I'd suggest investigating why libopenslide isn't being loaded. Does the system try to load the library, and fail? Does it not even try? Does the EXE declare linkage against OpenSlide? |
Are you linking your test program with More generally, you could try playing with compiler and linker options (disabling optimization, etc.). |
Experimented both with /OPT:NOREF and several optimization switches, none of them solve the problem. Very strange issue... |
Argh. Some thoughts on hacky workarounds:
Do either of those work? |
Great, both solutions work! A bit hacky, but especially the first one seems workable. Thanks for your help. Of course I'm still wondering whats going on in the linker when including both boost-thread and OpenSlide, I put it on verbose, no warnings whatsover. Well, this solves this problem for me at least. |
It seems to cause strange intermittent linking problems with MSVC11 (openslide/openslide#124, openslide/openslide#125), and apparently isn't needed for /OPT:REF support on that platform.
Closing as fixed by openslide/openslide-bin@20a3d46e via #125. Please post a comment if you see this again. |
I'm trying to use OpenSlide in our software, which is linked against a third party library. When compiling a simple test program under Windows (VC11)
include "openslide.h"
include < iostream >
using namespace std;
int main(int argc, char* argv[])
{
cout << "Openslide version: " << endl;
cout << openslide_get_version() << endl;
cout << "Program completed" << endl;
return 0;
}
this will work. However, the third-party software links against boost/thread, and adding the line
include "boost/thread/future.hpp"
will cause the program to crash at the openslide_get_version() line. Inspecting it with a debugger shows that libopenslide will not be loaded in this case. I compiled openslide using Cygwin and the winbuild scripts on the same system. Anybody any guesses why this is happening? My own best guess up till now is that boost/thread/future.hpp uses rvalues and maybe the executable resulting from compiling Cx11 with VC11 is incompatible with the libopenslide.lib compiled with MinGWx64? And that not including future.hpp will result in a compiled executable with more backward compatibility? Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: