Re: [R] cdecl and stdcall

From: Prof Brian Ripley <>
Date: Thu 22 Sep 2005 - 01:33:13 EST

This really is the wrong list. Please do read the posting guide as we do ask (before posting). In so far as this is relevant to R at all, it is within the description of the R-devel list.

On Wed, 21 Sep 2005, Bogner, Konrad (LfU) wrote:

> I'm trying to load a dynamic link library and it seems to work
> (is.loaded -> TRUE). When I run the function, which calls the .Fortran
> subroutine, R crashes! I'v tried the same in S-Plus 2000 and it worked.
> Therefore I suppose that the dll has been compiled with the stdcall
> calling convention (and not cdecl).

Hmm. Why do you suppose so? In so far as I can recall S-PLUS 2000 (it is long obselete) it worked with cdecl (as it was built with Watcom compilers). The rw-FAQ explains how to get debugging information on the crash, which could have many causes.

> But the problem is that I don't have access to the source code, I've
> just the dll without any working import library. Maybe someone could be
> so kind and send me an example how to write a wrapper? I've found one
> example at the NAG's site
> (, but it didn't work. At
> there is a description of
> linking against dlls and how to create a def and an import libraray
> file, but unfortunately my dll seems to be stripped, because I get the
> error message "no symbols" after running the command "nm".

A DLL with no symbols would be of no use to anyone, but your confusion is that nm does not apply to DLLs. You need to find out what the DLL is exporting, with what convention. pedump and pexports are the usual Open Source tools to do so. The convention is normally hidden in the real symbol name, e.g. foo@8 is a stdcall entry point, but may be aliased to foo.

> I'm using R 2.1.0 (windows xp) and CYGWIN (gnu compilers,..)

Cygwin is not a platform we support for R.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Thu Sep 22 02:39:32 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:36:14 EST