From murdoch at stats.uwo.ca  Mon Mar 19 22:32:27 2007
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 19 Mar 2007 17:32:27 -0400
Subject: [Rd] Rinternals.h and undefined symbols
In-Reply-To: <9001E5A6-9080-4224-92ED-4867C858C637@ic.ac.uk>
References: <9001E5A6-9080-4224-92ED-4867C858C637@ic.ac.uk>
Message-ID: <45FF016B.3060505@stats.uwo.ca>

On 3/19/2007 5:23 PM, Ernest Turro wrote:
> Hi,
> 
> I'm trying to register my native routines using R_registerRoutines 
> (...). I can compile the code, but the loader cannot resolve the symbol:
> 
> undefined symbol:  
> _Z18R_registerRoutinesP8_DllInfoPK12R_CMethodDefPK15R_CallMethodDefS3_S6 
> _
> 
> $ nm bgx.Rcheck/bgx/libs/bgx.so | grep R_registerRoutines
>                   U  
> _Z18R_registerRoutinesP8_DllInfoPK12R_CMethodDefPK15R_CallMethodDefS3_S6 
> _
> 
> Why does it have this funny name? If I look at libR.so, I get an  
> ordinary symbol name:

That looks like C++ name mangling.  Are you wrapping your declarations in

extern "C" { }

?

Duncan Murdoch


> 
> $ nm ~/lib64/R/lib/libR.so | grep R_registerRoutines
> 0000000000032f80 T R_registerRoutines
> 
> I get normal symbol names for R functions not in Rinternals.h and  
> there is no problem there. For example:
> 
> nm bgx.Rcheck/bgx/libs/bgx.so | grep Rprintf
>                   U Rprintf
> 
> $ nm ~/lib64/R/lib/libR.so  | grep Rprintf
> 0000000000129690 T Rprintf
> 
> The shared library dependencies are also fine:
> 
> $ ldd bgx.Rcheck/bgx/libs/bgx.so
>          libR.so => /home/et04/lib64/R/lib/libR.so (0x0000002a95676000)
>          libstdc++.so.6 => /usr/lib64/libstdc++.so.6  
> (0x0000002a95a80000)
>          libm.so.6 => /lib64/tls/libm.so.6 (0x0000002a95c70000)
>          libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000002a95df7000)
>          libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a95f02000)
>          libRblas.so => /home/et04/lib64/R/lib/libRblas.so  
> (0x0000002a96136000)
>          libg2c.so.0 => /usr/lib64/libg2c.so.0 (0x0000002a96262000)
>          libreadline.so.4 => /usr/lib64/libreadline.so.4  
> (0x0000002a96383000)
>          libncurses.so.5 => /usr/lib64/libncurses.so.5  
> (0x0000002a964bc000)
>          libdl.so.2 => /lib64/libdl.so.2 (0x0000002a96618000)
>          /lib64/ld-linux-x86-64.so.2 (0x000000552aaaa000)
> 
> My LD_LIBRARY_PATH environmental variable is set appropriately.
> 
> Any ideas?
> 
> Thanks,
> 
> E
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Rinternals.h and undefined symbols
Duncan Murdoch