M
Merrill Lane
Hi,
I am attempting to link an object file and a shared library into an executable.
My object file makes calls to two functions in the shared library (MY_FUNC1
and MY_FUNC2).
I am seeing the following error:
==> cc -o MY_EXECUTABLE MY_OBJECTFILE -L. -R. -lMY_SHARED_LIBRARY
Undefined first referenced
symbol in file
MY_FUNC1 MY_OBJECTFILE
ld: fatal: Symbol referencing errors. No output written to
MY_EXECUTABLE
When I do an "nm" on the shared library, grepping for the functions I use,
I get:
[...] | ...| ...|FUNC |LOCL |2 |10 |MY_FUNC1
[...] | ...| ...|FUNC |GLOB |0 |10 |MY_FUNC2
So it makes sense that I got the linker error because MY_FUNC1 is
LOCL. However, both functions have prototypes in the same public header file,
with the same storage modifiers (extern). Neither of the functions is static.
So, my question is, why is MY_FUNC1 made into a LOCL function, unusable by
by my executable (while MY_FUNC2 is GLOB and usable by my executable).
Any thoughts would be appreciated.
Thanks,
Merrill
I am attempting to link an object file and a shared library into an executable.
My object file makes calls to two functions in the shared library (MY_FUNC1
and MY_FUNC2).
I am seeing the following error:
==> cc -o MY_EXECUTABLE MY_OBJECTFILE -L. -R. -lMY_SHARED_LIBRARY
Undefined first referenced
symbol in file
MY_FUNC1 MY_OBJECTFILE
ld: fatal: Symbol referencing errors. No output written to
MY_EXECUTABLE
When I do an "nm" on the shared library, grepping for the functions I use,
I get:
[...] | ...| ...|FUNC |LOCL |2 |10 |MY_FUNC1
[...] | ...| ...|FUNC |GLOB |0 |10 |MY_FUNC2
So it makes sense that I got the linker error because MY_FUNC1 is
LOCL. However, both functions have prototypes in the same public header file,
with the same storage modifiers (extern). Neither of the functions is static.
So, my question is, why is MY_FUNC1 made into a LOCL function, unusable by
by my executable (while MY_FUNC2 is GLOB and usable by my executable).
Any thoughts would be appreciated.
Thanks,
Merrill