[Rd] Function name exported incorrectly in DLL, strange entries in tmp.def
Stravs, Michael
Michael.Stravs at eawag.ch
Mon Feb 29 19:00:45 CET 2016
Hi,
I originally posted this on the Rcpp github tracker, but it was suggested I post it here.
I tried to compile the package https://github.com/khabbazian/sparseAHC/ under Windows. The package requires C++11 so I had to install the R devel build with gcc 4.9.3, and the latest Rtools.
I got compilation and installation to work using Rcpp (0.12.3, from CRAN source). Package loads fine. However, when I tried to use the functions:
* the Rcpp exported function ```sparseAHC_dgCIsSymmetric``` works correctly
* the Rcpp exported function ```sparseAHC_run_sparseAHC``` doesn't work.
I could not see anything wrong with the source files and therefore looked at the DLL with DependencyWalker. Interestingly:
* ```sparseAHC_dgCIsSymmetric``` is named correctly
* ```sparseAHC_run_sparseAHC``` is named
```sparseAHC_run_sparseAHC.weak._ZNSt4listIiSaIiEE7emplaceIJiEEESt14_List_iteratorIiESt20_List_const_iteratorIiEDpOT_._ZNK4Rcpp14not_compatible4whatEv.weak._ZNSt6vectorIdSaIdEE19_M_emplace_back_auxIJdEEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv.weak._ZNSt6vectorIiSaIiEE19_M_emplace_back_auxIJRKiEEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv.weak._ZNSt6vectorISt4pairIS0_IiiEdESaIS2_EE12emplace_backIJS2_EEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv.weak._ZNSt6vectorISt4pairIS0_IiiEdESaIS2_EE19_M_emplace_back_auxIJS2_EEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv.weak._ZNSt8_Rb_treeIiSt4pairIKiSt14_List_iteratorI7EdgeObjEESt10_Select1stIS5_ESt4lessIiESaIS5_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESG_IJEEEEESt17_Rb_tree_iteratorIS5_ESt23_Rb_tree_const_iteratorIS5_EDpOT_._ZNK4Rcpp14not_compatible4whatEv.weak._ZNSt8_Rb_treeIiSt4pairIKiSt14_List_iteratorIiEESt10_Select1stIS4_ESt4lessIiESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJOiEESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_._ZNK4Rcpp14not_compatible4whatEv```` instead!
To find out what is going on, I compiled again and captured the ```tmp.def``` which is generated during compilation. As one can see, directly behind the problematic function name there are a lot of entries starting with ```.weak``` that are apparently incorrectly picked up upon by the linker:
```
[...]
ZZN4Rcpp8internal12exitRNGScopeEvE3fun
_ZZN4Rcpp8internal13enterRNGScopeEvE3fun
sparseAHC_dgCIsSymmetric
sparseAHC_run_sparseAHC
.weak._ZNSt4listIiSaIiEE7emplaceIJiEEESt14_List_iteratorIiESt20_List_const_iteratorIiEDpOT_._ZNK4Rcpp14not_compatible4whatEv
.weak._ZNSt6vectorIdSaIdEE19_M_emplace_back_auxIJdEEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv
.weak._ZNSt6vectorIiSaIiEE19_M_emplace_back_auxIJRKiEEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv
.weak._ZNSt6vectorISt4pairIS0_IiiEdESaIS2_EE12emplace_backIJS2_EEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv
.weak._ZNSt6vectorISt4pairIS0_IiiEdESaIS2_EE19_M_emplace_back_auxIJS2_EEEvDpOT_._ZNK4Rcpp14not_compatible4whatEv
.weak._ZNSt8_Rb_treeIiSt4pairIKiSt14_List_iteratorI7EdgeObjEESt10_Select1stIS5_ESt4lessIiESaIS5_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS1_EESG_IJEEEEESt17_Rb_tree_iteratorIS5_ESt23_Rb_tree_const_iteratorIS5_EDpOT_._ZNK4Rcpp14not_compatible4whatEv
.weak._ZNSt8_Rb_treeIiSt4pairIKiSt14_List_iteratorIiEESt10_Select1stIS4_ESt4lessIiESaIS4_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJOiEESF_IJEEEEESt17_Rb_tree_iteratorIS4_ESt23_Rb_tree_const_iteratorIS4_EDpOT_._ZNK4Rcpp14not_compatible4whatEv
_Z12order_leavesRN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEEi
_Z13run_sparseAHCN5Eigen12SparseMatrixIdLi0EiEEN4Rcpp6VectorILi16ENS2_15PreserveStorageEEE
_Z14dgCIsSymmetricN5Eigen12SparseMatrixIdLi0EiEEd
[...]
```
I cannot find this problem documented anywhere. But it seems that somehow additional exports are generated that start with ```.weak```, and the linker mangles all of them into one function name.
Help?
Michael Stravs
Eawag
Umweltchemie
BU E 23
Überlandstrasse 133
8600 Dübendorf
+41 58 765 6742
[[alternative HTML version deleted]]
More information about the R-devel
mailing list