From ernest.turro at ic.ac.uk  Tue Mar 20 00:41:16 2007
From: ernest.turro at ic.ac.uk (Ernest Turro)
Date: Mon, 19 Mar 2007 23:41:16 +0000
Subject: [Rd] Rinternals.h and undefined symbols
In-Reply-To: <45FF016B.3060505@stats.uwo.ca>
References: <9001E5A6-9080-4224-92ED-4867C858C637@ic.ac.uk>
	<45FF016B.3060505@stats.uwo.ca>
Message-ID: <4E0FCC76-D2E2-40E3-A2F7-C15519D286C1@ic.ac.uk>


On 19 Mar 2007, at 21:32, Duncan Murdoch wrote:

> 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" { }
>
> ?

Yeah, the routine is literally just:

extern "C"
   void R_init_bgx(DllInfo *info) {
     R_registerRoutines(info, cMethods,NULL,NULL,NULL);
   }

with cMethods declared outside as a static const R_CMethodDef.

The two routines that I am registering are also wrapped in extern "C".

Ernest


>
> 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
Ernest Turro