Jump to content
  • Advertisement
Sign in to follow this  
garyfletcher

Custom makefile with Dev-C++ - how do I define a variable when compiling? (SOLVED)

This topic is 4871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi people. I'm trying to build a dll with Dev-C++. Two of the functions I have I want only to be built when I am creating the dll. When the DLL is being used in a project I want the developer to provide the definitions for the functions. Currently I have a #define in a header file:
#define BUILD_DLL
and in the .cpp I have
#ifdef BUILD_DLL
bool func1(someargs)
{
   return true;
}

bool func2(someargs)
{
   return true;
}
#endif
I am pretty sure that I can set up the Dev-C++ project options to pass in BUILD_DLL therefore having no need fo the #define in the header file but I can't rememger how to do it. In the Makefile tab under project options I can set extra makefile parameters but does anyone know the correct syntax? [Edited by - garyfletcher on June 21, 2005 1:09:20 AM]

Share this post


Link to post
Share on other sites
Advertisement
Why is it that you want to do this? It seems unnecessary to me, as the DLL and the program should be two separate projects, thus share no source files. And since that should be the case, you should just rename the functions in the DLL or not export them.

Share this post


Link to post
Share on other sites
As part of the DLL I have a game loop which requires that 2 functions exist as tags into the game project, the initial function...so the loop can initially call a function it knows and an exit function.

The initial function is placed on top of the stack and is called from the game loop. The exit function is always the final function on the stack and provides a safe mechanism for shuting down all other library functions, deleting tracked memory and generally cleaning up.

So just as tags from within the provided game loop.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!