[Firebird-devel] UDF lib works on Linux but crash on Windows (Error writing data to connection)

2019-05-06 Thread Massimo Fazzolari
works properly on Windows and Linux when compiled with FPC 2.6.4 (Lazarus 1.2.6) Does anybody have any clue what could cause this issue on Windows? Best regards Massimo Fazzolari Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel

Re: [Firebird-devel] UDF lib works on Linux but crash on Windows (Error writing data to connection)

2019-05-06 Thread Massimo Fazzolari
5.2019 9:48, Massimo Fazzolari wrote: > > Does anybody have any clue what could cause this issue on Windows? > >Bug in either your UDF or FPC. > > > -- >WBR, SD. > > > Firebird-Devel mailing list, web interface at > https://lists.sourceforge.net/lists/list

Re: [Firebird-devel] UDF lib works on Linux but crash on Windows (Error writing data to connection)

2019-05-06 Thread Massimo Fazzolari
n Simple(sz: PChar): PChar; cdecl; export; How memory for return parameter is allocated ? I use this udfmalloc, on windows is defined as: function udfmalloc(Size: Integer): Pointer; cdecl; external 'ib_util.dll' name 'ib_util_malloc'; On Mon, May 6, 2019 at 12:38 PM Vla

Re: [Firebird-devel] UDF lib works on Linux but crash on Windows (Error writing data to connection)

2019-05-06 Thread Massimo Fazzolari
ithout any change) using FPC 3.0.4. On Mon, May 6, 2019 at 3:12 PM Dimitry Sibiryakov wrote: > 06.05.2019 14:59, Massimo Fazzolari wrote: > > I use this udfmalloc, on windows is defined as: > > function udfmalloc(Size: Integer): Pointer; cdecl; external > 'ib_util.

Re: [Firebird-devel] UDF lib works on Linux but crash on Windows (Error writing data to connection)

2019-05-07 Thread Massimo Fazzolari
bit and 64 bit - * It doesn't work on FPC 3.0.4 on Windows 64 bit* On Mon, May 6, 2019 at 3:24 PM Massimo Fazzolari wrote: > Do you check returned value for nil? > > > Yes, this Simple function is just one of a big set of UDFs that we > exported in the same dll/so file. We

Re: [Firebird-devel] UDF lib works on Linux but crash on Windows (Error writing data to connection)

2019-05-07 Thread Massimo Fazzolari
May 2019 10:54:53 +0200 > Massimo Fazzolari wrote: > > > Anybody could help me to figure out what's wrong with the > > FPC 64bit compiler? Is there any compile/linker flag that I should > > use? > > It might help to tell us which compiler and linker flags you a

[Firebird-devel] Firebird UDF compiled with Lazarus 2.0.0 and FPC 3.0.4

2020-02-26 Thread Massimo Fazzolari
Hi, I compiled a Firebird UDF library written in object pascal. It works perfectly well on Windows. On Linux I get this error: SQL> select SIMPLE('test') from client; Statement failed, SQLSTATE = 08006 Error reading data from the connection. Firebird Version: Classic 2.5.9.27139-0 Lazarus Versi

Re: [Firebird-devel] Firebird UDF compiled with Lazarus 2.0.0 and FPC 3.0.4

2020-02-26 Thread Massimo Fazzolari
gt; but changes to using "cdecl" under Linux. > On 26/02/2020 13:30, Massimo Fazzolari wrote: > > Hi, > > I compiled a Firebird UDF library written in object pascal. It works > perfectly well on Windows. > > On Linux I get this error: > > SQL> selec

Re: [Firebird-devel] Firebird UDF compiled with Lazarus 2.0.0 and FPC 3.0.4

2020-02-27 Thread Massimo Fazzolari
> > What is actual definition of the UDF function? DECLARE EXTERNAL FUNCTION SIMPLE CSTRING (254) RETURNS CSTRING (254) FREE_IT ENTRY_POINT 'Simple' MODULE_NAME 'SitaUdfLib.dll' Ah, I remembered what is wrong with it. FPC by default uses bad > single-threaded memory > manager. You must a

Re: [Firebird-devel] Firebird UDF compiled with Lazarus 2.0.0 and FPC 3.0.4

2020-02-27 Thread Massimo Fazzolari
Thank you all guys, I finally managed to fix the issue: - There was an initialization section in one unit imported that set IsMultiThread = True - I removed the cthreads unit in the uses clause. Does anybody have any clue what are the implications of these changes? On Thu, Feb 27, 202

Re: [Firebird-devel] Firebird UDF compiled with Lazarus 2.0.0 and FPC 3.0.4

2020-02-27 Thread Massimo Fazzolari
> > What version of firebird do you use your UDF with? Classic 2.5.9.27139-0 On Thu, Feb 27, 2020 at 3:12 PM Alex Peshkoff via Firebird-devel < firebird-devel@lists.sourceforge.net> wrote: > On 2020-02-27 16:54, Massimo Fazzolari wrote: > > Thank you all guys, I final

Re: [Firebird-devel] Firebird UDF compiled with Lazarus 2.0.0 and FPC 3.0.4

2020-02-27 Thread Massimo Fazzolari
wrote: > On 2020-02-27 17:12, Massimo Fazzolari wrote: > > > > What version of firebird do you use your UDF with? > > > > > > Classic 2.5.9.27139-0 > > I've expected CS but 2.1 or less. > 2.5 is already MT product and it always appeared that IsMult