[R] __stdcall funcitons called using .C() on win32 chokes

Jeff D. Hamann jeff_hamann at hamanndonald.com
Sun Feb 16 05:33:03 CET 2003

I've developed a dll (win32) of a bunch of functions prototypes as:

/* for building on *nix */
#ifndef WIN32
#define __stdcall /*nothing*/

void __stdcall dbh_2_height(
  const unsigned long    *func_idx,
  const unsigned long    *metric,
  const unsigned long    *species,
  const double             *dbh,
  double                        *pred_height );

and have created a R interface function as,

## wrapper function for dbh_2_height /
dbh2height <- function( func, metric, sp, dbh )
    d <- double(length(func))

      d )[[5]]

I would like to keep the __stdcall in the source code and still use the
.C() in R to call the function as the library is already used for many
other projects. When I attempt to call the function (win32) I get an
application error. I've commented out the __stdcall and the library works
fine. Does anyone see a good solution around this? I would like to make
use of the library and the tcltk library to use R as a simulation


Jeff D. Hamann
PO Box 1421
Corvallis, Oregon USA 97339-1421
jeff_hamann at hamanndonald.com

More information about the R-help mailing list