Boost.System-based program closes up with code 255 before executing any of my code

My program is kind of large, but the problem is reproducible within a really really small test case.

I have a shared library that uses Boost and it’s built with CMake and Visual Studio. I wasn’t initially testing on Windows, then I missed some BOOST_SYMBOL_EXPORT, BOOST_SYMBOL_IMPORT and BOOST_SYMBOL_VISIBLE at first. I’ve started to use these macros and linkage problems disappeared. Some of the tests even run successfully now.

But I have this small 23-line test code for which the executable will close immediately with a code 255. There are only three implementation files used for this test:

  • http_category.hpp: 20 lines header file with a single function that is already annotated with BOOST_SYMBOL_EXPORT/BOOST_SYMBOL_IMPORT.
  • http_errc.hpp: 48 lines header file with 2 traits (only exist at compile time), 2 inline functions (I don’t know how they could interfere with the shared linkage) and a single enum that I’m annotating with BOOST_SYMBOL_VISIBLE.
  • http_category.cpp: 53 lines implementation file. Implements the http_category.hpp‘s function. It has one static object. I’m not sure if there is any problem here.

Some of the other tests run fine, like you can see on AppVeyor. But this minimal case that I just described doesn’t even show the “Running 1 test case…” message from Boost.Test.

Any tips on how to extract more info about the error or any idea on what may have gone wrong? I myself don’t own one Windows instance right now and the AppVeyor is all I have to play with.


Source: dll

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.