...и имат ли те почва у нас
#if defined(_MSC_VER)
# define SYMBOL_EXPORT __declspec(dllexport)
# define SYMBOL_IMPORT __declspec(dllimport)
#else
# define SYMBOL_EXPORT __attribute__((__visibility__("default")))
# define SYMBOL_IMPORT
#endif // fuck other compilers
#if defined COMPILING_SHARED_LIB_X
# define X_API SYMBOL_EXPORT
#else
# define X_API SYMBOL_IMPORT
#endif
....
class X_API Foo {};
class Bar {
public:
X_API void barFunc();
};
X_API void func();
// link with me
// dyn lib plugin
extern "C" X_API void foo(int a, float b);
// executable
auto lib = LoadLibrary("foo.dll") / dlopen("foo.so/dylib");
auto func = GetProcAddress("foo") / dlsym(foo);
auto foo = reinterpret_cast<void (*)((int a, float b));
foo(1, 2.3f);
FreeLibrary(lib) / dlclose(lib);