s-news
[Top] [All Lists]

C call - memory problem

To: <s-news@lists.biostat.wustl.edu>
Subject: C call - memory problem
From: <Agin.Patrick@hydro.qc.ca>
Date: Wed, 24 May 2006 15:03:40 -0400
Thread-index: AcZ+bMIIh60c+KsoRCSdVLKAvmFhvAA82NVg
Thread-topic: C call - memory problem

Dear all,

 

I built a DLL (under VC++) and loaded it in S-Plus (version 4.5, Windows XP) with dll.load(). When I do the call to my C function, S-Plus crashes and the following message appears:

 

SPLUS.EXE – Application Error

The instruction at {xxx}

 referenced memory at {yyy}. The memory could not be “read”.

 

The crash occurs between the end of the C function and the return to S-Plus. I suspect problems with the malloc/free calls so I wanted to replace them with S_alloc calls only but the compiler does not like it: “S_alloc function does not take 2 arguments” yet I included the header <S.h> as mentionned in the Programmer’s Guide. What am I doing wrong? Is the problem elsewhere? What could it be? I must admit that after reading topics in the S-news about C calls from S-Plus, I’m quite confused because some elements seem to apply only to more recent versions of my “good-old” S-Plus 4.5.

 

Any hints would be very appreciated.

Patrick

 

 

 

 

<Prev in Thread] Current Thread [Next in Thread>