Is there any way to basically do this in win32:
//SomeDLL
const int NeededInt=3;
//SomeApplication
#include <windows.h>
void main()
{
HANDLE DLL = LoadLibrary("SomeDLL");
int ResultantInt = GetInt(DLL, "NeededInt");
}
Basically what I need is a constant integer in a DLL that can NOT be changed at any time. Currently I have something like this:
//SomeDLL
extern "C" __declspec(dllexport) int GetNeededInt();
int GetNeededInt { return 3; }
//SomeApplication
#include <windows.h>
typedef int (*IntFncVoid)();
void main()
{
LoadLibrary("SomeDLL");
IntFncVoid TheFunc = GetProcAddress(DLL, "GetNeededInt");
if(!TheFunc) return;
int ResultantInt = TheFunc();
}
The problem here is I can make GetNeededInt() any function I want. I could make it call other functions. I could make it variable. But it's not supposed to be variable, it's supposed to stay the same, and things are likely to go awry if it is variable.
If there isn't a way, well then I guess it's the programmer's job to make sure DLL's work right (I'd just like to idiot proof the code when I can)
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?