From dmurdoch at pair.com  Mon Oct 27 21:36:55 2003
From: dmurdoch at pair.com (Duncan Murdoch)
Date: Mon Oct 27 21:35:55 2003
Subject: [Rd] (PR#4806)
In-Reply-To: <200310272000.h9RK0v0P014034@pubhealth.ku.dk>
References: <200310272000.h9RK0v0P014034@pubhealth.ku.dk>
Message-ID: <790rpvcg4p6351fn8tm0hb5cj8btpr055p@4ax.com>

On Mon, 27 Oct 2003 21:00:57 +0100 (MET), L.T.Kell@cefas.co.uk wrote :

>> I am trying to call functions written in Visual C++ from R version 1.8.0
>> under Windows. 
>> Although these functions ran correctly in version 1.7 in Version 1.8.0
>> they cause R to crash after the function has returned to R

You have a problem with the calling convention.

>> extern "C" __declspec(dllexport) SEXP __stdcall out(SEXP x, SEXP y)

R wants "cdecl", not "stdcall".

See my web page
<http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/> for
some advice (as well as readme.packages for VC++ advice).

Duncan Murdoch


[Rd] (PR#4806)
Duncan Murdoch