Forum
Off Topic c++ api programmingc++ api programming
2 replies 1
Here's a link to a YouTube clip that can teach you more about API programming. I hope that helps, else ask me any other questions regarding C++ and have a merry christmas omg!
Throw this preprocessor lines somewhere in your main header
1
2
3
4
5
2
3
4
5
#ifdef BUILD_DLL #define DLL_EXPORT __declspec(dllexport) //SHOW IN DLL #else #define DLL_EXPORT __declspec(dllimport) //READ FROM DLL #endif
1
2
3
4
5
2
3
4
5
#ifdef BUILD_DLL #define DLL_EXPORT __attribute__((visibility("default"))) //SHOW IN SO #else #define DLL_EXPORT //DO NOTHING #endif
1
2
3
4
5
6
2
3
4
5
6
#ifdef __WIN32__ //wincode #endif #ifdef __linux__ //linuxcode #endif
Now declare all your classes, structs and functions like this:
1
[class/struct/returntype] DLL_EXPORT [objectname]
Add BUILD_DLL as a #define in your project and build it.
Now you can set up your own library using the resulting .dll and .lib files (plus your header files, of course)
In case you built a linux .so, that's all you get (and all you need)
edited 6×, last 07.01.13 02:46:45 pm
1