Entering edit mode
Erik Wright
▴
210
@erik-wright-4003
Last seen 10.2 years ago
Hello all,
I am trying to interface Biostrings from C for the first time. I
followed the example given in the header of Biostrings_interface.h to
the letter (quite literally). In step "e" I paste the example
function into myFile.c, register it as a .Call entry point and compile
with R CMD CHECK. I get the following errors:
myFile.c:13: warning: implicit declaration of function cache_XRaw
myFile.c:13: error: incompatible types in assignment
myFile.c:14: error: cachedCharSeq has no member named elts
myFile.c:14: error: cachedCharSeq has no member named nelt
Based on the error, it seems like I still don't have access to any of
the Biostrings variable definitions. I have tried everything that I
can think of, so I am quite stuck. Does anyone know what I am doing
incorrectly? I have pasted myFile.c below for reference.
Thanks!,
Erik
//myFile.c
#include <rdefines.h>
#include <r_ext rdynload.h="">
#include <stdio.h>
#include <stdlib.h>
#include "Biostrings_interface.h"
SEXP print_XString_bytes(SEXP xstring)
{
cachedCharSeq x;
int i;
const char *x_char;
x = cache_XRaw(xstring);
for (i = 0, x_char = x.elts; i < x.nelt; i++, x_char++)
Rprintf("%x ", *x_char);
Rprintf("\n");
return R_NilValue;
}
/*
* -- REGISTRATION OF THE .Call ENTRY POINTS ---
*/
static const R_CallMethodDef callMethods[] = {
{"print_XString_bytes", (DL_FUNC) &print_XString_bytes, 1},
{NULL, NULL, 0}
};
void R_init_GoneFISHing(DllInfo *info)
{
R_registerRoutines(info, NULL, callMethods, NULL, NULL);
}
[[alternative HTML version deleted]]