Subject Re: [ib-support] Using UDF: "Connection Lost to Database"
Author Senthil Palanisamy
Hi Raymond,

This problem occurs due to access violation in the Usage of pointer
variable.
im not aware of delphi.
in C and C++ if we try like "copying a string to a pointer variable without
allocating the memory", then an access violation will take place and it will
kill the IB/firebird service.

regards,
senthil.

----- Original Message -----
From: "Raymond Kennington" <progsol@...>
Newsgroups: egroups.ib-support
To: <ib-support@yahoogroups.com>
Sent: Thursday, November 07, 2002 10:05 PM
Subject: [ib-support] Using UDF: "Connection Lost to Database"


> Using a UDF causes the error message: "Connection Lost to Database" to
appear.
>
> All the relevant code is below. What is causing this?
>
> Is all memory correctly allocated and destroyed by the following?
>
> How to make the following thread-safe?
>
> Any other suggestions to improve the following?
>
> TIA.
>
> Raymond.
> --------
>
> library Algorithms;
>
> uses
> SysUtils,
> Classes,
> ConfNum in 'ConfNum.pas';
>
> {$R *.res}
>
> exports
> CalcCheckDigit;
>
> begin
> end.
>
> unit ConfNum;
>
> interface
>
> function CalcCheckDigit(var TheConfNum : PChar; ResultBuffer : PChar) :
PChar; cdecl;
> export;
>
> implementation
>
> uses
> SysUtils;
>
> function CalcCheckDigit(var TheConfNum : PChar; ResultBuffer : PChar) :
PChar; cdecl;
> export;
> var
> c : array[0..1] of Char;
>
> i : Integer;
> begin
> Result := ResultBuffer;
>
> c[0] := 'A';
> c[1] := #0;
>
> StrCopy(Result, c);
> end;
>
> initialization
> IsMultiThread := True;
>
> end.
>
> DECLARE EXTERNAL FUNCTION CalcCheckDigit
> CSTRING(11) CHARACTER SET NONE,
> CSTRING(2) CHARACTER SET NONE
> RETURNS PARAMETER 2
> ENTRY_POINT 'CalcCheckDigit' MODULE_NAME 'Algorithms';
>
> SELECT CalcCheckDigit('0000111111') FROM RDB$DATABASE;
>
> --
> Raymond Kennington
> Programming Solutions
> W2W Team B
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com