Is it possible to call Linux shared libraries with Oxygene on Island? If so - how?
I am testing Water 9.2.0.2163 (beta), creating a Console Application (Linux).
do you have a header file? We have two options:
- Header importer (Difficult to setup atm, but when setup you have the whole header available to you)
- DllImport, something like:
[DllImport('libMyLibrary.so'), SymbolName('SymbolNameGoesHere')]
class method Test(a,b,c: Integer);
Yes I have the headers. Iâll try the HeaderImporter. But testing DLLImport with this code below results in
error E51: Implementation for method âclass method glfwInit()â is missing
Adding âexternal;â after class method glfwInit(); results in
lld.exe: error: undefined symbol: glfwInit
Since the .so isnât actually on my disk in Windows, should I copy it from my Linux machine so that the compiler/linker can verify it?
namespace linuxconsoleglfwtest;
type
Program = class
public
[DllImport('libglfw.so'), SymbolName('glfwInit')]
class method glfwInit();
class method Main(args: array of String): Int32;
begin
// add your own code here
writeLn('The magic happens here.');
end;
end;
end.
you need external
:
DllImport('libglfw.so'), SymbolName('glfwInit')]
class method glfwInit(); external;
Thanks, but it still doesnât build. The code
namespace linuxconsoleglfwtest;
type
Program = class
public
[DllImport('libglfw.so'), SymbolName('glfwInit')]
class method glfwInit(); external;
class method Main(args: array of String): Int32;
begin
// add your own code here
writeLn('The magic happens here.');
end;
end;
end.
Results in the error below after building. Is the linker trying to link the library statically and doesnât find it because the .so file isnât on the (Windows) disk?
âŚ
IslandLink:
Run: âC:\Program Files (x86)\RemObjects Software\Elements\Bin\lld.exeâ -flavor gnu â@obj\Debug\Linux\linkercmdâ
C:\Program Files (x86)\MSBuild\RemObjects Software\Elements\RemObjects.Elements.Island.Linux.targets(90,5): error : C:\Program Files (x86)\RemObjects Software\Elements\Bin\lld.exe: error: undefined symbol: glfwInit [C:\Users\tedi7\Documents\RemObjects Software\Elements\Water\linux-console-glfwtest\linux-console-glfwtest.elements]referenced by ld-temp.o
lto.tmp:(_extmdd__rtti_t1c_linuxconsoleglfwtest.Program)
Done Building Project âC:\Users\tedi7\Documents\RemObjects Software\Elements\Water\linux-console-glfwtest\linux-console-glfwtest.elementsâ (default targets) â FAILED.
Done Building Project âC:\Users\tedi7\Documents\RemObjects Software\Elements\Water\linux-console-glfwtest\obj\linux-console-glfwtest.water.temp.slnâ (Build target(s)) â FAILED.
Build FAILED.
hmm, can you send me a full project?
Hrmm that link doesnât work?
Works perfectly now, thanks.
Thanks, logged as bugs://78082
bugs://78082 got closed with status fixed.
Thanks, confirmed fixed in 9.2.0.2167.
Btw, my Water/Island test is very very promising!