Re: [Rd] Initializing a large data structure to be accessed strictly within a shared C library

From: James Muller <>
Date: Tue, 27 Dec 2011 20:36:17 -0500

Thanks Duncan, you've unclogged my thinking. For anybody interested, see below a sketch of the solution.



#include <Rinternals.h>

static typedef struct {

    int nrow, ncol;
    double *data;
} _myparticle_data_struct;

static _myparticle_data_struct myparticle_data;

void myparticle_init() {

    // Before we begin, call this from .Call() to Ralloc() memory and load the     // data into to

void myparticle_free() {

    // When we're done with the PSO, .Call() to Free() the data

void myparticle_eval(double *value, double *x) {

    // .Call() to evaluate the value *value given vector x[]

--END SKETCH OF SOLUTION-- mailing list Received on Wed 28 Dec 2011 - 01:38:54 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 28 Dec 2011 - 15:20:21 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive