Recent

Author Topic: [solved]RTL Event inside linux dynamic library (.so)  (Read 1046 times)

mata_fp

  • Newbie
  • Posts: 6
[solved]RTL Event inside linux dynamic library (.so)
« on: June 23, 2020, 01:44:41 pm »
Hi,

I have a problem with RTL Event. RTLEventCreate always returns NIL when it's called from dynamic library.

If I call the function from graphical application (LCL), everything works as intended and function returns valid pointer.

Is there something I am missing?

Thanks for the help.

OS: Linux Mint XFCE x64
Lazarus: 2.0.0
FPC:   3.0.4


Code: Pascal  [Select][+][-]
  1. library knihovna;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. {$R *.res}
  6.  
  7. var Evt: PRTLEvent;
  8.  
  9. function Get_Version: Int32; cdecl;
  10. begin
  11.   Evt := Nil;
  12.   Evt := RTLEventCreate;
  13.  
  14.   If Evt <> Nil then Result :=  111
  15.                 else Result := -222;
  16.  
  17.   RTLEventDestroy(Evt);
  18. end;
  19.  
  20. exports
  21.   Get_Version;
  22.  
  23. begin
  24. end.
  25.  
« Last Edit: June 24, 2020, 01:20:18 pm by mata_fp »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12105
  • FPC developer.
Re: RTL Event inside linux dynamic library (.so)
« Reply #1 on: June 23, 2020, 01:46:12 pm »
Shared library have a complete separate copy of all state, so you probably must also include unit cthreads in the library.


mata_fp

  • Newbie
  • Posts: 6
Re: RTL Event inside linux dynamic library (.so)
« Reply #2 on: June 23, 2020, 02:09:23 pm »
Thanks  :)

 

TinyPortal © 2005-2018