Subject | Re: [ib-support] Using UDF: "Connection Lost to Database" |
---|---|
Author | Raymond Kennington |
Post date | 2002-11-08T09:33:01Z |
Frank Ingermann wrote:
Now I have changed cdecl; export; to stdcall; but there is not change.
given to me.
Also, where is IB_Util.PAS and is it relevant to FB?
TIA.
Raymond.
Raymond Kennington
Programming Solutions
W2W Team B
>Thanks. I've read those.
> Hi Senthil / Raymond,
>
> two pointers that might help:
> http://firebird.sourceforge.net/index.php?op=useful&id=geldenhuis
> http://firebird.sourceforge.net/index.php?op=useful&id=deatz_udf#left
>
> both from the "really useful" section -- the name says it all! <g>
Now I have changed cdecl; export; to stdcall; but there is not change.
>I've read the source to that in entirety, so I'm ready to understand any explanations
> you can also download http://www.cvalde.com/utilities/FreeUDFLib.zip,
> it includes Delphi sources so you can see how it's done.
given to me.
Also, where is IB_Util.PAS and is it relevant to FB?
TIA.
Raymond.
>--
> regards & hth,
> fingerman
>
> Senthil Palanisamy wrote:
> > 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
> >>
Raymond Kennington
Programming Solutions
W2W Team B