Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mdblabs

Pages: [1]
1
Development / [SOLVED] Wrapper Segfault
« on: October 11, 2017, 12:13:47 am »
Hi,
first of all, I would like to thank you for this great open source project, and community!

I'm trying to create an stand-alone version of solarus, wrapping the execution of the quest, just as the editor code does. I have satisfactory compiled solarus library, and I have created a simple scaffolding C++ code to wrap the execution.

Basically, it mimics solarus-editor's "play" functionality, or solarus -run. The idea is to have a stand-alone binary file, which runs the MainLoop. This is just a test, to understand correctly how solarus works.

Here is my basic main:

Code: [Select]
int main()
{
std::vector<std::string> arguments = {"","./quest"};
std::vector<char*> argv;

for (const auto& arg : arguments)
    argv.push_back((char*)arg.data());
argv.push_back(nullptr);

const Arguments args(argv.size() - 1, argv.data());   
MainLoop(args).run();

return 0;
}

My quest folder is on same level as binary file. I am using solarus trunk library version (1.6.0), which I compiled without any issue.

Also, if I open my quest with solarus editor, editor runs it without any problem (it's just a basic, clean, quest).

When I run my binary looks like it detects the quest, but I obtain a segfault when it tries to open it.

Here is my output:
Code: [Select]
./solarus
[Solarus] [0] Info: Solarus 1.6.0
[Solarus] [0] Info: Opening quest './quest'
Segmentation fault: 11

I'm running everything on MacOS and compiled with g++.

Thank you very much for your help.

Best,
mdb

Pages: [1]