Hello,
I'm really not sure if this is due to my incompetence or an issue with the code. Anyway, I'm trying to use the import lib to import the threading library. Unfortunately, I hit a crash as soon as I try.
Here's the stacktrace:
> importlib("sqratthread", {});
Process 89422 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (supertux2) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x0000000000000000
frame #1: 0x0000000100608c13 supertux2`sqrat_importbin(SQVM*, char const*) + 67
frame #2: 0x0000000100608852 supertux2`sqrat_import + 162
frame #3: 0x0000000100608d1f supertux2`sqratbase_import(SQVM*) + 111
frame #4: 0x0000000100605ac2 supertux2`SQVM::CallNative(SQNativeClosure*, long long, long long, SQObjectPtr&, int, bool&, bool&) + 834
frame #5: 0x00000001006011dc supertux2`SQVM::Execute(SQObjectPtr&, long long, long long, SQObjectPtr&, unsigned long long, SQVM::ExecutionType) + 2300
frame #6: 0x0000000100600507 supertux2`SQVM::Call(SQObjectPtr&, long long, long long, SQObjectPtr&, unsigned long long) + 183
frame #7: 0x00000001005cf9b9 supertux2`sq_call + 121
frame #8: 0x0000000100324ef9 supertux2`Console::execute_script(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 1161
I successfully registered the importlib using
if(SQ_FAILED(sqrat_register_importlib(global_vm)))
throw SquirrelError(global_vm, "Couldn't register import lib");
I'm assuming that the load cases in https://github.com/SuperTux/sqrat/blob/master/sqimport/sqratimport.cpp#L215 don't cover OS X, maybe?
The Sqrat import library is not highly tested. I never worked on it personally either.
For all I know, the import library was more of a proof-of-concept than a production-quality library.
So, I'm unable to easily help you with your issue.
I fixed this issue with https://github.com/SuperTux/sqrat/commit/c42e14a5f3f2136fc6366ed86d592b81f6683884 . If you want, you can push that upstream.
Last edit: Tobias Markus 2017-12-25