Subject | Creating & Compilin UDF Linux |
---|---|
Author | yosvanyllr |
Post date | 2006-11-23T16:24:44Z |
Hi guys,
This are my C source code to execute(call) an external application
called "extract" from an "F_EXTAPP" UDF. NOTE* "extract" application
works perfect on my PC.
I compile this code with gcc version 4.1.0 (SUSE Linux) as:
g++ -fPIC -g -c -Wall udfapp.c
g++ -shared -Wl,-soname,udfapp.so -o udfapp.so udfapp.o -lc
file
udfapp.c---------------------------------------------------------------------------
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define EXPORT
#include "ibase.h"
#include <stdio.h>
#include <cstdlib>
int check_args (int argc){
if(argc == 3) {return 0;}else return 1;
}
int EXPORT extapp (int argc, char *argv[]){
char params[255];
if (check_args(argc) ==0){
sprintf(params,"./extract -f %s -t %s >
%s",argv[1],argv[2],argv[3]);
system(params);
return 0;
} else return 1;
}
----------------------------------------------------------------------------------------------
This application receive 3 varchars as paremeter from a table. I try
to create the UDF as:
DECLARE EXTERNAL FUNCTION F_EXTAPP
CSTRING(255)
RETURNS Integer
ENTRY_POINT 'extapp'
MODULE_NAME 'udfapp.so';
and I receive this error :
*** IBPP::SQLException ***
Context: Transaction::Commit
SQL Message : -104
Invalid token
Engine Code : 335544343
Engine Message :
invalid request BLR at offset 43
function TIMBL is not defined
module name or entrypoint could not be found
What is wrong here?.
Thank's in advanced
Yosvany
This are my C source code to execute(call) an external application
called "extract" from an "F_EXTAPP" UDF. NOTE* "extract" application
works perfect on my PC.
I compile this code with gcc version 4.1.0 (SUSE Linux) as:
g++ -fPIC -g -c -Wall udfapp.c
g++ -shared -Wl,-soname,udfapp.so -o udfapp.so udfapp.o -lc
file
udfapp.c---------------------------------------------------------------------------
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define EXPORT
#include "ibase.h"
#include <stdio.h>
#include <cstdlib>
int check_args (int argc){
if(argc == 3) {return 0;}else return 1;
}
int EXPORT extapp (int argc, char *argv[]){
char params[255];
if (check_args(argc) ==0){
sprintf(params,"./extract -f %s -t %s >
%s",argv[1],argv[2],argv[3]);
system(params);
return 0;
} else return 1;
}
----------------------------------------------------------------------------------------------
This application receive 3 varchars as paremeter from a table. I try
to create the UDF as:
DECLARE EXTERNAL FUNCTION F_EXTAPP
CSTRING(255)
RETURNS Integer
ENTRY_POINT 'extapp'
MODULE_NAME 'udfapp.so';
and I receive this error :
*** IBPP::SQLException ***
Context: Transaction::Commit
SQL Message : -104
Invalid token
Engine Code : 335544343
Engine Message :
invalid request BLR at offset 43
function TIMBL is not defined
module name or entrypoint could not be found
What is wrong here?.
Thank's in advanced
Yosvany