Jump to content
Sign in to follow this  
CmdJohnson

Trouble developing an extension for linux server

Recommended Posts

Hello everyone,

I recently gained interest in developing an extension for my arma 3 linux server.

I went to the wiki (-> Extensions#Linux_shared_library_interface (first post, so no links)), compiled the example, put the resulting example.so in my server root directory and called

it via

diag_log ["Output: %1", "example" callExtension "version"];

from within my init.sqf file.

However, I get no output (besides "Output: ", what is definately not the output I want).

So, the three possible Errors that come into my mind are:

  1. the C code is broken
  2. I'm calling the extension the wrong way
  3. I placed the file at the wrong location

I already tried to modify the code to always return "It works!" whenever I call it, and I tested the whole extension

by writing a small program, that loads it and calls the function; in that case, I got the desired output, so I guess the extension itself is okay.

I'm realy stuck on this, so any clues are appreciated.

Share this post


Link to post
Share on other sites

Where did you put the extension that you are trying to call? Also, have you tried writing to a file or something to see if the extension code is executing?

Share this post


Link to post
Share on other sites

I put that thing into my arma 3 server root directory, at the same level as the main executable, but I also tried putting it in a subfolder and adding that folder as a mod (the .so in the ./@example folder, with parameter -mod="@example").

Writing to a file, again, works completely fine with my test program, but called from within the sqf script just does nothing at all.

Share this post


Link to post
Share on other sites

when on a 64-bit linux make sure to compile it as 32-bit

gets the shared library loaded by the server? (check with lsof, strace, ...)

Share this post


Link to post
Share on other sites

Well.. thanks

Turned out I really compiled it as a 64bit library, I should've thought of that

Compiling it with the -m32 flag did the magic for me, now everything works just fine!

Share this post


Link to post
Share on other sites

Hey, sorry for necroing this thread but cannot create any new one.

Is there any way to compile C++ code into Shared Object for Arma ?

I've been compiling it with gcc & g++ many times, but only the C code is working (otherwise extension isn't loaded).

Here are the commands I used:

gcc -shared -fPIC -m32 -o example.so example.c

gcc -shared -fPIC -m32 -o example.so example.cpp

g++ -shared -fPIC -m32 -o example.so example.c

gcc -shared -fPIC -m32 -o example.so example.cpp

Thanks.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×