How to link in shared library?

J

James Egan

I'm just beginning to learn C++. If the test()
function listed below was in a shared object
library named mylib.so, how would I access then
from another .cpp program? Can someone please
show me a .cpp example, and then how to link it
with GNU g++? I tried to find the answer on google,
but could not.

-Thanks


#include <iostream>

using namespace std;

void test()
{
cout << "In test() function" << endl;
}
 
V

Victor Bazarov

James said:
I'm just beginning to learn C++. If the test()
function listed below was in a shared object
library named mylib.so, how would I access then
from another .cpp program? Can someone please
show me a .cpp example, and then how to link it
with GNU g++? I tried to find the answer on google,
but could not.

Please post to gnu.g++.help. Shared objects are not defined by
the C++ language, they are platform-specific and as such are
off-topic here.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,665
Latest member
salkete

Latest Threads

Top