#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
/* To use this exported function of dll, include this header
* in your project.
*/
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern"C"
{
#endif
int DLL_EXPORT global = 2;
int DLL_EXPORT SomeFunction()
{
global=+4;
return global;
}
// a sample exported function
int DLL_EXPORT SomeFunction();
#ifdef __cplusplus
}
#endif
#endif // __MAIN_H__
And when I use compiled DLL SomeFunction return 4 (not 6).
What should I do to get 6? I want to use global vars for many functions.