Re: [R] Cannot call R's ISNAN() from a C code in >1.7 versions.

About this list Date view Thread view Subject view Author view Attachment view

From: Prof Brian Ripley (ripley@stats.ox.ac.uk)
Date: Mon 24 May 2004 - 16:40:42 EST


Message-id: <Pine.LNX.4.44.0405240729290.14723-100000@gannet.stats>

First, there are no versions 1.7, 1.8 and 1.9.

Was your version of R compiled against MSVC++ 6.0? The binary on CRAN was
not, and binaries for different versions of R were compiled with different
versions of MinGW. The entry point isnan is part of the statically linked
runtime on modern MinGW.

MSVC++ 6.0 does supply _isnan (as it really should as it is part of the
C99 ISO standard), and you need to link against it appropriately. Hint:
it may have an extra underline, since it seems it is known to C as _isnan.
You may need to add

#undef ISNAN
#define ISNAN(x) _isnan(x)

We don't support adding extensions to R using a different compiler to the
one used to build R. Changes already made for future releases of R will
make this less likely to work in R 2.0.x.

On Mon, 24 May 2004, Paul Y. Peng wrote:

> Dear R users,
>
> Have you experienced any difficulty in calling R's ISNAN() from a C
> code? I have C codes including ISNAN() calls and they worked well until
> I upgraded my R from 1.7 to later versions. When I tried to compile the
> codes in the version 1.8 and 1.9, I got error messages like this:
>
> test.obj : error LNK2001: unresolved external symbol _isnan
> .\testR.dll : fatal error LNK1120: 1 unresolved externals
> NMAKE : fatal error U1077: 'link.exe' : return code '0x460'
> Stop.
>
> I checked "Writing R Extensions" and did not find any changes in the API
> entry point for ISNAN in the later versions. Could any one enlighten me
> on why _isnan cannot be resolved? The compiler I used is MSVC++ 6.0 and
> the platform is WinXP. Many thanks.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:12 EST