too many arguments in foreign function call
Duncan Murdoch <murdoch at stats.uwo.ca> writes:
On Mon, 16 Jul 2001 19:23:52 +0100 (GMT Daylight Time), you wrote in message <Pine.WNT.4.31.0107161916001.1056-100000 at tern.stats>:
The argument is that new code should probably be using .Call (if S compatibility is relevant) or .External rather than .C, at least provided that a C wrapper is feasible. Those interfaces seem very much under-used. (Including by me, for S3-compatibility reasons.)
The difficulty with using .External is that it only works with C, not with other languages, because you need the R header definitions. I think there is a fairly large group of programmers like myself who aren't very comfortable programming in C. The .C interface isn't tied to the R header files the way .External is, so it's not too hard to call other languages with it. I use it with Delphi and Kylix, for instance. It's a nice quirk that ".C" is the interface to use for general external code, and ".External" for C code.
That's a coincidence, highly dependent on other languages abiding the C calling conventions (and arguably, .External is really interfacing to a Scheme-like runtime system rather than general C code...) It's like Brian says: If you can figure out how to call the other language from C, then it really shouldn't be any trouble to setup a wrapper using either of the interfaces .C, .Call, and .External. And given that you usually need "onionskin" routines to convert pointer arguments for call-by-value usage, the extra work of zipping a bunch of scalar arguments out of a vector does seem rather minute.
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._