Hi !!, I'm trying to communicate to programs using a DLL. I need to share data between them so I'm using the
#pragma data seg() command but It doesn´t work. I call the first function, WinINT1, and I write k with the first program, then I read k with the second program calling the secong function, test. But the value of k is not actualised so they are not using the same variable. this seems very simple but I can´t make it work.
Gracias !, from Argentine.
/***************************************************************************************************
#include "dll.h"
#include <windows.h>
#include <malloc.h>
#include <memory.h>
#include <math.h>
#include <float.h>
#include <iostream>
#include <fstream>
#include <stdio.h>
using namespace std;
#pragma data_seg("SHARED")
double k=0;
#pragma data_seg()
#pragma comment(linker, "/section:SHARED,RWS")
//function 1
extern "C" double WINAPI _export WinINT1(double input)
{
k=input;
return(k);
}
//function 2
extern "C" int WINAPI _export test(double x[99], double y[99])
{
y[0] = k;
return (0); //0 means no error, other values may be displayed as warnings
}
/*********************************************************************************************