search for: my_c_funct

Displaying 5 results from an estimated 5 matches for "my_c_funct".

Did you mean: my_c_fun
2010 Nov 15
1
SEXP and slots
Hello, Since people have whisperred about Rcpp, I'd like to play too. > On 11/15/2010 07:45 AM, Patrick Leyshock wrote: >> Very helpful, thank you. >> >> A couple other questions, please: >> >> 1. I've got a function written in C, named "my_c_function". In my R >> code I call this function, passing to it an INTSXP and a STRSXP, >> respectively: >> >> result <- .Call("my_c_function", int_vector, str_vector) >> >> The prototype of "my_c_function" is: >> >> SEXP m...
2011 Dec 28
1
external pointers
...ode to some C code. Per Section 5.13 of "Writing R Extensions", I've noted that "external pointers should only be used as part of an object with normal semantics, for example an attribute or an element of a list." So I've written up a workable C function as such: SEXP my_c_function(SEXP param) { SEXP temp = getAttrib(param, install("ptr_attribute")); void * ptr = R_ExternalPtrAddr(temp); ... // do useful things with ptr } I can pass my_c_function() an object with "normal" semantics (such as an integer vector), where the external poi...
2010 Oct 27
2
must .Call C functions return SEXP?
...et to R_NilValue, which should be fine. I must be misunderstanding something here, but I don't know what, and would definitely appreciate any help. Thanks! My R code looks like this: result.1 <- vector("list" ,1e6) result.2 <- vector("list" ,1e6) .Call("my_C_function", result.1, result.2, other.input) My C code looks like this: SEXP result_v; result_v = Rf_allocVector(REALSXP, 5); SET_VECTOR_ELT(result_list_1, k1, result_v); REAL(result_v)[0] = some_number; REAL(result_v)[1] = another_number; /* Also do the same sort of thing for resu...
2007 Feb 21
2
R unstable and crashes after executing .C
...ect (creating a new one or even just writing the name of an existing one). I use R 2.4.0 under a Linux machine with 1 GB RAM. Below there is an example of execution, so you can get an idea of what is happening: -------------------- dyn.load("my_C_module.so"); res <- .C("my_C_function",.....); #The function executes fine and res is ok dyn.unload("my_C_module.so") #I know this isn't strictly necessary #Here R is still running, but when I execute: m <- matrix(0,1000,100); #I try to create a new object and R crashes *** caught segfault *** add...
2007 Feb 21
1
R unstable and crashes after executing .C
...arge object (creating a new one or even just writing the name of an existing one). I use R 2.4.0 under a Linux machine with 1 GB RAM. Below there is an example of execution, so you can get an idea of what is happening: -------------------- dyn.load("my_C_module.so"); res <- .C("my_C_function",.....); #The function executes fine and res is ok dyn.unload("my_C_module.so") #I know this isn't strictly necessary #Here R is still running, but when I execute: m <- matrix(0,1000,100); #I try to create a new object and R crashes *** caught segfault *** address 0x10,...