Hello, 

I get a strange compilation error when compiling a cfunction() inline when my C 
code functions are compiled in a list with other functions, but not when they 
are compiled by themselves. Here is an example:

# begin "test.R"

library(inline)

a.sig <- signature(a1="integer")
a.body <- " int var = *a1;"

b.sig <- signature(a1="integer", a2="integer", a3="integer", a4="integer", 
a5="integer", a6="integer")
b.body <- " 
	int var = 0;
	*a6 = *a5;
	*a5 = *a4;
	*a4 = *a3;
	*a3 = *a2;
	*a2 = *a1;
	*a1 = var;
	printf(\"%d\\n\", *a1);
	"

c.sig <- signature(a1="integer")
c.body <- " int var = *a1;"

cfns <- cfunction(sig=list(a=a.sig, b=b.sig, c=c.sig),
	body=list(a.body, b.body, c.body),
		  includes="#include <stdio.h>",
	
		  language="C", 
		  convention=".C", 
		  verbose=TRUE
)
# end "test.R"

the error:
> source("test.R")
Compilation argument:
 /usr/lib64/R/bin/R CMD SHLIB file17e9255aef8a.c 2> 
file17e9255aef8a.c.err.txt 
gcc -std=gnu99 -I/usr/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g 
-O2 -flto -c file17e9255aef8a.c -o file17e9255aef8a.o
gcc -std=gnu99 -shared -g -O2 -flto -fpic -L/usr/local/lib64 -o 
file17e9255aef8a.so file17e9255aef8a.o -L/usr/lib64/R/lib -lR
Error in names(body) <- c(NA, "", names(sig[[i]])) : 
  'names' attribute [8] must be the same length as the vector [3]
> 

I get no problems compiling those functions by themselves, such as:

b.fn <- cfunction(sig=b.sig, body=b.body, includes="#include <stdio.h>",	
  language="C", convention=".C", verbose=TRUE )


Of course, I want to compile the functions together because I want to call one 
function from the other, but this is just an example

Can someone help me to sort this out?

Mikhail.


	[[alternative HTML version deleted]]

