Rob,
The previous response was so uncharacteristically rude I can only hope
that some sort of follow up apology was sent to the questioner for a regrettable
lapse in civility.
That being said, your question did lack sufficient detail (and I didn't
read it close enough) to give you a precise answer, but if your question is "Is
it OK to pass pointers into and out of S?" the answer is a qualified yes. It is
OK if the pointers were allocated using the standard (non-S) allocation routines
(malloc, or new). That is, a pointer to memory allocated during one .C call is
still available to subsequent .C calls, and passing as a long and casting to a
pointer is the way to do it.
Matt
On Sat, 11 Sep 1999, Prof Brian D Ripley wrote:
>
> On Sat, 11 Sep 1999, Rob Reynolds wrote:
>
> > Hi, I have just recently started looking at a trial version of S-Plus.
>
> So, you don't have a support contract and are hoping for some free advice?
>
> > I'm interesting in calling functions from a financial analytics library
> > written in C.
>
> (Your examples were not in valid C.)
>
> > I'm running into a little trouble and am looking for some help in figuring
> > out the right syntax.
>
> You haven't told us what goes wrong! But lots of things are relevant here,
> for example what compiler you used, how you made the DLL (normally you need
> call="cdecl" in the dll.load call), .... You haven't even told us that
> you are using Windows, nor defined most of your types. Try doing some
> debugging (if this is S-PLUS 2000 and you have Visual C++ it is very easy).
>
> However, my bottom line is that S-news is for enquiries about S and S-PLUS,
> not to provide free technical support to a commercial organization on how
> to write C interfaces.
>
> [... lots of C++-like code omitted]
>
> --
> Brian D. Ripley, ripley@stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272860 (secr)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message: unsubscribe s-news
>
>
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|