How to pass arguments to a method loaded from a static library in CPP
I'm trying to write a program to use a static library of a C++ code into another C++ code. The first C++ code is hello.cpp : #include <iostream> #include <string.h> using namespace std; extern "C" void say_hello(const char* name) { cout << "Hello " << name << "!\n"; } int main(){ return 0; } The I made a static library from this code, hello.a , using this command: g++ -o hello.a -static -fPIC hello.cpp -ldl Here's the second C++ code to use the library, say_hello.cpp : #include <iostream> #include <string> #include <dlfcn.h> using namespace std; int main(){ void* handle = dlopen("./hello.a",