| 1. |
How To Write Udf S In Delphi? |
|
Answer» <P>It’s quite simple. the only thing you need to remember is that you must always USE ib_util_mallocOto allocate memory if your UDF returns string result. The UDF must be declared as FREE IT. so that Firebird releases the memory after it reads the string. To use ib_util_mallocO, you need to import it from ib_utildil into your program - and make sure you use it instead of regular memory alocating functions. Here’s a simple example of Delphi UDF: function IB uti l_rnalloc(l: integer): POINTER; cdecl: external ‘ib_util.dll; Declaration in Firebird: It’s quite simple. the only thing you need to remember is that you must always use ib_util_mallocOto allocate memory if your UDF returns string result. The UDF must be declared as FREE IT. so that Firebird releases the memory after it reads the string. To use ib_util_mallocO, you need to import it from ib_utildil into your program - and make sure you use it instead of regular memory alocating functions. Here’s a simple example of Delphi UDF: function ib uti l_rnalloc(l: integer): pointer; cdecl: external ‘ib_util.dll; Declaration in Firebird: |
|