Dominick Samperi
2010-Apr-23 18:42 UTC
[Rd] Unresolved symbols when objects are in subdirectories?
Hello,
I have built a shared lib from C++ source files in pkg/src, and
from another directory pkg/src/test. Everything seems to work,
and all functions are in the library (based on
nm mylib.so | grep myfunc). But when I try to call
a function with, say .Call('myfunc'), the symbol myfunc is
found when it was exported from a file in pkg/src, but
it is not found when it was exported from a file in pkg/src/test.
Let me stress that when the function is defined in pkg/src/test
the nm command shows that myfunc is defined as a text segment
in the .so file, yet when I try .Call('myfunc') it is not found.
Furthermore, if I move the source file that defines myfunc
from pkg/src/test to pkg/src, then everything works fine,
the symbol is found.
I checked the g++ command line and it builds the library
like it should with a line like
g++ -shared -o mylib.so whatever.o test/myfunc.o ...
Bottom line is it seems like ALL functions defining
symbols to be used in R must be located in pkg/src.
They cannot be located in pkg/src/whatever.
Am I missing something obvious here?
Thanks,
Dominick
[[alternative HTML version deleted]]