file: test.c
CODE:
#include <stdio.h>
#include <stdlib.h>
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#include <string.h>
#include <math.h>
#include <ibase.h>
#include "example.h"
#include "ib_util.h"
#ifdef CPU386 /* Fast assembler version exists for 386/486 */
#pragma inline
#endif
char* TEST_replace(char *source, char *replace_this, char *replacement){
char *result = NULL;
result = (char *)ib_util_malloc(strlen(source)+1);
result=strcpy(result, source);
*(result+strlen(source))='\0';
return result;
}
main(){
}
File: test.def
Code:
IBRARY test
DESCRIPTION 'test.dll'
DATA READ WRITE
EXPORTS
TEST_replace
DECLARE:
DECLARE EXTERNAL FUNCTION REPLACEME
CSTRING(5000) CHARACTER SET NONE,
CSTRING(200) CHARACTER SET NONE,
CSTRING(200) CHARACTER SET NONE
RETURNS CSTRING(5000) FREE_IT
ENTRY_POINT 'TEST_replace' MODULE_NAME 'test'
gcc test.c -shared -fPIC -o test.so -I/opt/firebird/include
-I/opt/firebird/examples -I/opt/firebird/lib
UDF are written on C, has faced a problem.
Earlier compiled UDF worked under FireBird 1.5, on FireBird 2.0 - the base
falls.
Has altered malloc on ib_util_malloc with include ib_util.h compiled under
Windows
on VC 6.0 - works on FB 1.5 and FB 2.0
Now a problem under Linux and FreeBSD, UDF I compile: mistakes are not present,
UDF does not work.
but if I try use:
on FireBird 1.5.3
opt/firebird/bin/fbguard: bin/fbserver terminated abnormally (127)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
Firebird-test mailing list
Firebird-test@...
https://lists.sourceforge.net/lists/listinfo/firebird-test