markg 0 Posted January 31, 2020 Using Delphi 10.3, I am writing a Linux library (an .so). I need to use some functions from fmx.graphics, but if I add it to my uses clause it does bad things although it compiles fine. If I add it to my uses clause, without even doing anything else in code, I get the following error when I call the library (.so): "Unable to init server: Could not connect: Connection refused". However, if I write a stand-alone Linux console app and add fmx.graphics, it works just fine. Is this something similar to when writing a Windows dll and using vcl,graphics, you must call GdiplusStartup first to initialize the graphics subsystem? If anyone has any ideas or examples, please send them my way. Share this post Link to post
Kryvich 165 Posted February 3, 2020 Sorry can't help, Delphi CE here, no Linux compiler. I tried creating a DLL that uses FMX.Graphics unit. No problem in Windows 10. Share this post Link to post
markg 0 Posted February 3, 2020 I'm using Windows 10 also. Did you call your dll from another program - possibly a console app? It gives the error when it's run, not at compile time. Share this post Link to post
Kryvich 165 Posted February 3, 2020 Yes, I can call my DLL function, no error. Library source code: library DllWithFmx; uses System.SysUtils, System.Classes, FMX.Graphics; {$R *.res} function TestDll: Integer; stdcall; begin Result := Integer(TFontWeight.Semibold); end; exports TestDll; begin end. Console app that use the DLL (the static linking is used): program DllUse; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; function TestDll: Integer; stdcall; external 'DllWithFmx.dll'; var i: Integer; begin i := TestDll; Writeln(i); Readln; end. Share this post Link to post