Problem With Public Variable

 

Hi,
I have one dll that used by one platform(MetaTrader) and another exe file.
I define one Public variable(PP) in header code and set value in
MT4_EXPFUNC double __stdcall Reza(double ppp) function.

When try call this dll from my exe it returns only Zero(0) value but if call from other platform(MetaTrader) returns correct value.

#define WIN32_LEAN_AND_MEAN  // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>

double price();
double pp;
 
#define MT4_EXPFUNC __declspec(dllexport)
 
BOOL WINAPI DllEntryPoint(HINSTANCE hDll,DWORD dwReason, LPVOID Reserved)
{
	switch(dwReason)
	{
	case DLL_PROCESS_ATTACH:
		break;
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
  
 

 

MT4_EXPFUNC double __stdcall Reza(double ppp)
  {
   pp=ppp;
  
   return (pp);
  }
 

double price(){
double dd;
dd=pp;
return dd; 

}

How I must define public variable to return correct value?

Regards,

 

Learn about inter-process communications (IPC), shared memory etc.

Reason: