Subject Re: udf writing
Author Ian A. Newby
> MSVC's malloc routine handles memory allocation in a manner "all its
> own". That is, we can't rightly infer how it manages memory, but it
> certainly does not allocate memory in the same fashion as Delphi. So, a
> Delphi function that tries to dynamically allocate memory using GetMem
> or the Windows system call GlobalAlloc will most certainly cause
> problems with InterBase if used in conjunction with the free_it
keyword. >>

I've written two UDF libraries (one for blobs and one for guids) and
both were compiled using gcc cross compiling for windows on a linux box.
The secret is to use the "returns parameter x" methodology of
returning things.

If you use returns parameter x the server allocates the memory and
passes it to the udf. You can use whatever mechanism you want inside
the function as long as it clears up after itself.


Ian Newby