I have a program which I’m trying to compile in to a static library. During development, I had a small main function that simply parsed the command line arguments and called an appropriate function - that worked fine. I’m now trying to build the static library, and call in to it from a c++ file rather than a Haxe generated one. The function is essentially the same though - I’m even calling Sys.args() from the c++ code just to try to make it as similar as possible to what Haxe generated.
The problem that I’m having is that when using the static library, as soon as Sys.args() is called I’m getting an exception thrown in StackContext::pushFrame: this was nullptr
. The call stack looks like this:
|>|CPPMTK.exe!hx::StackContext::pushFrame(hx::StackFrame * inFrame) Line 479|C++|
| |CPPMTK.exe!hx::StackFrame::StackFrame(const hx::StackPosition * inPosition) Line 653|C++|
| |CPPMTK.exe!Sys_obj::args() Line 42|C++|
| |CPPMTK.exe!main() Line 13|C++|
My program right now is pretty simple:
#include "stdafx.h"
#include "Sys.h"
int main()
{
::Sys_obj::args();
return 0;
}
The only thing that seems relevant in my .hxml for the library is that I have the flags NO_PRECOMPILED_HEADERS
and static_link
set.
It seems like my problem is the same as this one, but unfortunately there was no solution found. I am using threads within the static library, but at the point that the exception is thrown, nothing has been done with the threads. I don’t use C++ that often so I’m not that great at it, but since the executable is working, I would think that there’s just something that I’m missing when building either the static library or my test application. Any ideas what that could be?