GLBasic forum

Main forum => GLBasic - en => Topic started by: Qedo on 2011-Aug-26

Title: common memory area
Post by: Qedo on 2011-Aug-26
It is  possible in GLBasic runs in parallel (multitasking?) two (or more) programs  and to share a common memory area?
I think it would be useful the use of pointers but is not possible in GLBasic
Perhaps using INLINE. Does anyone have any examples?
Ciao
Title: Re: common memory area
Post by: hardyx on 2011-Aug-27
You can make a DLL library to share the data without access directly to the memory, instead use shared DLL variables.
Title: Re: common memory area
Post by: Moru on 2011-Aug-27
or you could use networking to talk to the different instances. Not as fast so if you are doing something heavy I guess this isn't what you want :-)
Title: Re: common memory area
Post by: hardyx on 2011-Aug-28
You'r right, DLL code is shared for applications, but data is not shared, each program has his own data. Code is in the DLL memory space, and data is in the main app address space. You can share data between two apps using FileMapping in Windows. You create a shared memory area with the desired size and map in the libray memory. You can copy the data you want to share there. You must to use pointers, wich you can manage in GLBasic using INLINE code.

http://msdn.microsoft.com/en-us/library/ms686958%28v=vs.85%29.aspx
Title: Re: common memory area
Post by: Dark Schneider on 2011-Aug-29
But it will not work on sandboxed devices, like iPhone and probably Android, so you should search for another solution in your program.
Title: Re: common memory area
Post by: Kitty Hello on 2011-Aug-29
What are you trying to achieve in detail? I think there's a much better way.