Subject UDF with cstring return parameter cause error
Author Tsutomu Hayashi
Hi all

I am creating udf library that handles aliases.conf.

I will create this udf both for Windows and Linux. So I am writting this in C++.

I have finished working on windows with BCC32, then this is working correctoly.

Next I am porting for linux with gcc, then I have problem.

I maked shared object name and executed this from
firebird then raise error, engine stalled.

This case is rased next code. This is simplified case.

void test(char* ret)
string str("tomneko");
strcpy(ret, str.c_str());

So I investigated this problem, next case is ok.

void test(char* ret)
strcpy(ret, "tomneko");

This simple test case is correctly working with firebird, but previous
one is wrong. Of course on windos both is working correctly.

Why is this happend?

#BTW using ib_util_malloc() is another solution for this problem, but
I want to use "return parameter" clause, cause this is simplified

From Tomneko (Tsutomu Hayashi)
web site