Today, I read the web blog article, How to make executable shared libraries . In this article it states that if one types at a Linux command prompt:
gcc -shared service.c -o libservice.so -Wl,-soname,libservice.so -W1,-e lib_entry
followed by
./libservice.so, then we can directly executer the lib_entry function.
However, when I run a similar g++ command:
g++ -shared one.cpp two.cpp three.cpp -o libservice.so -Wl,-soname,libservice.so -W1,-e lib_entry
where lib_entry
is a C
function defined in two.cpp
I get the warning message:
No entry point lib_entry point found.
How do I fix this warning message so I can directly run the entry point, lib_entry
? Should I enclose the implementation of the C
function foo
with extern "C"
linkage to resolve this problem?