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

2020-02-27 Thread Alex Peshkoff via Firebird-devel
On 2020-02-27 18:13, Massimo Fazzolari wrote: It worked fine for us with FPC 2.X, I experienced the issue reported when I ported the code to FPC 3.0.4. Will setting IsMultiThread = False affect the performances on FB Classic 2.5 ? sorry -  can only try to guess it: should not On Thu, Feb 27

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

2020-02-27 Thread Massimo Fazzolari
It worked fine for us with FPC 2.X, I experienced the issue reported when I ported the code to FPC 3.0.4. Will setting IsMultiThread = False affect the performances on FB Classic 2.5 ? On Thu, Feb 27, 2020 at 4:01 PM Alex Peshkoff via Firebird-devel < firebird-devel@lists.sourceforge.net> wrote:

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

2020-02-27 Thread Carlos H. Cantu
Title: Re: [Firebird-devel] Firebird UDF compiled with Lazarus 2.0.0 and FPC 3.0.4 More than 15 years ago, I found that FPC didn't produce PIC code, and this made UDFs to crash the FB server. When I was testing, it was really easy to reproduce the problem, specially with SuperServer: ope

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

2020-02-27 Thread Alex Peshkoff via Firebird-devel
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 IsMultiThread in pascal should match that fact i.e. shold be True. But all that

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 finally managed to fix the issu

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

2020-02-27 Thread Alex Peshkoff via Firebird-devel
On 2020-02-27 16:54, Massimo Fazzolari wrote: 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 implic

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 liviuslivius
Two things1. What is calling convention should be cdecl.2. How do you alloc memory for string?Regards,Karol Bieniaszewski nullFirebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel

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 Dimitry Sibiryakov
26.02.2020 16:34, Dimitry Sibiryakov wrote: Something else must be wrong in his UDF (or FPC). Ah, I remembered what is wrong with it. FPC by default uses bad single-threaded memory manager. You must add cmem and cthread units as the first to your project "uses" list. -- WBR, SD. Fireb

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

2020-02-27 Thread Virgo Pärna via Firebird-devel
What is actual definition of the UDF function? -- Virgo Pärna virgo.pa...@mail.ee Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel

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

2020-02-26 Thread Dimitry Sibiryakov
26.02.2020 14:58, Tony Whyman wrote: Note: IBX uses "stdcall" when accessing the Firebird API under Windows, but changes to using "cdecl" under Linux. Yes, but UDF always use cdecl on any platform. Besides, he compiled for x86_64 where only one calling convention exists. Something else must

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

2020-02-26 Thread Massimo Fazzolari
I am not familiar with Firebird core dumps, I read this article: https://www.ibphoenix.com/resources/documents/development/doc_36 I am running Firebird 2.5 Classic configured with systemd [1] . I changed the .service file to make firebird running as root. I did run the script in /opt/bin/restoreRo

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

2020-02-26 Thread Tony Whyman
My guess is that you are using the wrong calling convention for Linux. Note: IBX uses "stdcall" when accessing the Firebird API under Windows, 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 pasca

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

2020-02-26 Thread Dimitry Sibiryakov
26.02.2020 14:30, Massimo Fazzolari wrote: On Linux I get this error: SQL> select SIMPLE('test') from client; Statement failed, SQLSTATE = 08006 Error reading data from the connection. Check firebird.log for error messages. Enable core dumps and analyse them in debugger. -- WBR, SD.

[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