0

I am trying to write a custom linux library(*.so) and I stuck already at the basics. I would like to use this library via JNA. The problem is that when Eclipse is trying to run the method Test() this error-message appears Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'Test': /path/to/libexports.so undefined symbol: Test

Here is the lib code:

#ifdef EXPORTS
    #define NATIVE_API __declspec(dllexport)
#else
    #define NATIVE_API __declspec(dllimport)
#endif

extern "C" {
    NATIVE_API int __stdcall Test(){
        cout << "hello!";
    }
}

This is the Java code:

public interface IJnaTest extends StdCallLibrary{
    IJnaTest instance = (IJnaTest) Native.loadLibrary("exports",     IJnaTest.class);
    public int Test();
}

The call in the main:

IJnaTest.instance.Test()

Can anybody tell me why this is not working?

Regards Wurmi

wurmi
  • 333
  • 5
  • 18

1 Answers1

0

Ahh. I found it!

I had to extend the interface just from Library not from StdCallLibrary.

wurmi
  • 333
  • 5
  • 18