build externals with revolution 2.2.1 on HP-UX

Are you developing an External using the LiveCode Externals SDK?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
LaurentMeriel
Posts: 1
Joined: Tue Apr 19, 2011 12:35 pm

build externals with revolution 2.2.1 on HP-UX

Post by LaurentMeriel » Tue Apr 19, 2011 3:30 pm

Hello,

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 file "library.linux.makefile" contained in the directory "ExternalEnvironment/configuration/" : I add the option -fPIC to the "LDFLAGS".
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"
Errors occurred at line EXTERNAL_BEGIN_DECLARATIONS("rnahello").
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

Post Reply

Return to “Building Externals”