Subject | Re: [ib-support] Using UDF: "Connection Lost to Database" |
---|---|
Author | Frank Ingermann |
Post date | 2002-11-09T13:47:17Z |
Hi Raymond,
Raymond Kennington wrote:
written only udfs that work on ints and floats, freeUDFlib has all the string
funcs i need...
the Knowledgebase from the last IBPhoenix CD, here's what came out:
<quote from doc0593.htm>
3)RETURNS PARAMETER N: Use this argument to the DECLARE EXTERNAL FUNCTION state
ment
that specifies that the return value for the UDF is stored in the input paramet
er N. This feature has
been deprecated and was not certified under 5.x; it was by accident that it was
documented in the
manuals. With that said, use at your own risk. The only additional concern is
that the output value's
length can not exceed that of the input variable's declaration. Under the pre-5
.x engine, the values
being passed back were thread-safe.
</quote>
When you look at freeudflib, all string funcs are declared as:
declare external function f_lrTrim
cstring(254)
returns
cstring(254) /* free_it */
entry_point 'lrTrim' module_name 'FreeUDFLib.dll';
all the Result strings are made with the MakeResultString() func in
udf_glob.pas. As said, i'm no string-udf-expert, but it seems reasonable that if
you make your udf work in a similar way it should do the job.
calling all malloc / free_it experts! :-)
regards & good luck!
fingerman
--
-------------------------------------------------------------------------
when parsers parse, and compilers compile, then why don't objects object?
fingerbirdy - fingerman's door to Firebird
http://www.fingerbird.de
Raymond Kennington wrote:
> Now I have changed cdecl; export; to stdcall; but there is not change.don't think so, i've never used it - but i should clarify that so far i've
>
>>you can also download http://www.cvalde.com/utilities/FreeUDFLib.zip,
>>it includes Delphi sources so you can see how it's done.
>
>
> I've read the source to that in entirety, so I'm ready to understand any explanations
> given to me.
> Also, where is IB_Util.PAS and is it relevant to FB?
written only udfs that work on ints and floats, freeUDFlib has all the string
funcs i need...
>>>>DECLARE EXTERNAL FUNCTION CalcCheckDigiti just did a search on "returns parameter" (as i never heard of it honestly) in
>>>>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;
the Knowledgebase from the last IBPhoenix CD, here's what came out:
<quote from doc0593.htm>
3)RETURNS PARAMETER N: Use this argument to the DECLARE EXTERNAL FUNCTION state
ment
that specifies that the return value for the UDF is stored in the input paramet
er N. This feature has
been deprecated and was not certified under 5.x; it was by accident that it was
documented in the
manuals. With that said, use at your own risk. The only additional concern is
that the output value's
length can not exceed that of the input variable's declaration. Under the pre-5
.x engine, the values
being passed back were thread-safe.
</quote>
When you look at freeudflib, all string funcs are declared as:
declare external function f_lrTrim
cstring(254)
returns
cstring(254) /* free_it */
entry_point 'lrTrim' module_name 'FreeUDFLib.dll';
all the Result strings are made with the MakeResultString() func in
udf_glob.pas. As said, i'm no string-udf-expert, but it seems reasonable that if
you make your udf work in a similar way it should do the job.
calling all malloc / free_it experts! :-)
regards & good luck!
fingerman
--
-------------------------------------------------------------------------
when parsers parse, and compilers compile, then why don't objects object?
fingerbirdy - fingerman's door to Firebird
http://www.fingerbird.de