Archived

This topic is now archived and is closed to further replies.

ArnoAtWork

Static or Dynamic library

Recommended Posts

Spudder    385
You could do something like this:


#ifdef BUILD_DLL
#define MY_API __declspec(dllexport)
#else
#define MY_API __stdcall
#endif

int MY_API SomeFunction(void);



This way if you define the symbol MY_API then all the methods which you have prefixed with MY_API will be exported to the .dll otherwise they will be compiled as ordinary methods.

To create the .lib and .dll you will need two separate projects to build each version but the source code will be the same in both projects, you don't have to make changes to export the methods in the .dll project for example.

[edited by - Spudder on January 17, 2004 8:16:59 AM]

Share this post


Link to post
Share on other sites