Subject | UDF with cstring return parameter cause error |
---|---|
Author | Tsutomu Hayashi |
Post date | 2009-10-28T02:25:07Z |
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 aliases_udf.so 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
declarations.
--
+++++++++++++++++++++++++++++++
From Tomneko (Tsutomu Hayashi)
tomneko.h@...
web site http://www.tomnekosoft.com
+++++++++++++++++++++++++++++++
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 aliases_udf.so 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
declarations.
--
+++++++++++++++++++++++++++++++
From Tomneko (Tsutomu Hayashi)
tomneko.h@...
web site http://www.tomnekosoft.com
+++++++++++++++++++++++++++++++