I'm trying to build an application with revolution 2.2.1, to control a data acquisition and control system on network.
To do so, I need to call functions written in C, meaning I have to write my own Externals.
I have to work with Revolution 2.2.1, but I used Revolution 2.8 to generate External skeleton using ExternalEnvironmentV3, that I found on the tutorial Linux Externals on the RunRev website.
I exactly follows the steps (in fact, I copy/paste the rnahelloUser code), but something goes wrong.
When I type "gmake test.debug" in the directory "ExternalsEnvironmentV3", the following errors occurred :
(I only report the last line where gcc is used)
Code: Select all
gcc -fno-exceptions -g -Wall -I./src -I../_build/debug/headers -D_LINUX -D_DEBUG -c -o../_cache/debug/test/test.so ./src/test.c
./src/test.c: 70: error: expected identifier or '(' before string constant
./src/test.c: In function '__dummy_function':
./src/test.c: 70: warning: implicit declaration of function 'getXTable'
gmake[2] : *** [../_cache/debug/test/test.o] Error 1
I edit the Makefile contained in "ExternalsEnvironment/test" : I suppress the CUSTOM_CCFLAGS "-fno-rtti" (because I use C and not C++).
I work with :
HP-UX 11.11 PA-RISC 2.0
gcc v4.2.3
GNU make v3.82
RunRev Revolution v2.2.1
ExternalEnvironmentV3 (generated with Revolution v2.8 )
The file "ExternalsEnvironmentV3/test/src/test.c" is (the same as in the Runrev tutorial without comments ant the second function) :
Code: Select all
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <revolution/external.h>
void rnaHelloUser(char *p_arguments[], int p_argument_count, char **r_result, Bool *r_pass, Bool *r_err)
{
if (p_argument_count != 1)
{
*r_result = strdup("wrong number of parameters");
*r_err = True;
*r_pass = False;
return;
}
unsigned int t_buffer_length;
char *t_buffer;
t_buffer_length = strlen(p_arguments[0]) + 8 + 1;
t_buffer = (char *)malloc(t_buffer_length);
if (t_buffer == NULL)
{
*r_result = strdup("out of memory");
*r_err = True;
*r_pass = False;
return;
}
sprintf(t_buffer, "Hello, %s!", p_arguments[0]);
// t_buffer now contains a pointer to the result so just return...
//
*r_result = t_buffer;
*r_err = False;
*r_pass = False;
}
EXTERNAL_BEGIN_DECLARATIONS("rnahello") // errors occurred at this point.
EXTERNAL_DECLARE_FUNCTION("rnahellouser", rnaHelloUser)
EXTERNAL_END_DECLARATIONS"
I don't know if externals can even be used with HP-UX, and if it can I'd appreciate somebody can help me.
Regards