PureBasic Multi Thread DLL Problem

Blitz3D Forums/Blitz3D Programming/PureBasic Multi Thread DLL Problem

I think it's never possible to share memory between processes even if you use GlobalAlloc() , that's what MS-API says:
"In the linear Win32 API environment, there is no difference between the local heap and the global heap."

The Global/LocalAlloc() difference is meant for the old Win3.1 environment.

In Win32 you can share memory using several methods:

1) You can use a system wide DLL (all processes will LOAD the same copy of the DLL and variables are static, each program that will access the DLL, will get the same values of variables used in the DLL).

2) Memory mapped files. It's a great way. I used them to make a fast communication between programs using "ports" you set by name (sort of Amiga :). I have a DLL with funcions like OpenPort("Name") and SendData("Name") and all programs that have opened that port can read/write data from/to it. It works fine also with Blitz programs.

3) There is a funcion to retrieve the "real" memory address allocated by another process and get a valid pointer to it.. sorry I don't remember the name of such API call. This seems the fastest method (you only pass a pointer) , but I don't know how much "the system" takes to do that.

Look for "shared memory" on MSDN.