Subject | Re: [firebird-support] Problems with UDF and Linux |
---|---|
Author | Martijn Tonies |
Post date | 2006-01-24T21:38:24Z |
Hello FabrÃcio,
First of all - please do not use "high priority" mail to a e-mailinglist.
Hundreds of people will get your e-mail and it's not important to
them.
of type "string" are cleaned up after being used. You have
to allocate space for the resulting string (via ib_alloc or
something) and then copy the contents from the string to
the PChar memory place.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
First of all - please do not use "high priority" mail to a e-mailinglist.
Hundreds of people will get your e-mail and it's not important to
them.
> I did a UDF in Delphi and it's work fine in my Windows servers.Sounds like the server has crashed.
>
> Than I compiled it in kylix with sucsses and put in the directory
> /opt/interbase/UDF/abcs_udf.so on my linux server but I can't do the UDF
> work.
> Every time that I run a SQL using the UDF in the IBExpert I lose the
> connection with the firebird server.
> If I execute the select using the udf in the isql of my linux server I
> receive the message: "Statement failed, SQLCODE = -902 Error reading
> data from the connection.".
> Why do it occours? Why does the UDF works fine in the windows server andHuh? PChar? ResAux was of type STRING!
> it doesn't work on linux server?
>
> See the Object Pascal code of my function:
>
> function udf_FormatFloat(var Valor: Double; FormStr: PChar; Pontos:
> PChar): PChar; cdecl; export;
> var
> ResAux: string;
> begin
> ResAux := pchar( FormatFloat( FormStr, Valor ) );
> if Pontos = 'N' thenWhere is your memory allocated for the result? Items
> begin
> ResAux := AnsiReplaceStr( ResAux, '.', '' );
> ResAux := AnsiReplaceStr( ResAux, ',', '' );
> end;
> Result := PChar( ResAux );
> end;
of type "string" are cleaned up after being used. You have
to allocate space for the resulting string (via ib_alloc or
something) and then copy the contents from the string to
the PChar memory place.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com