QsharedMemory or QsharedData ?
Hi,
I would like to share a structure containing multiples data tyoe ( QString, QList and other pointer to custom styructures ) from my Main .exe with other .exe ( which are actually Instruments drivers).
I checked the doc and the web, still not totally clear to me between QsharedMemory and QsharedData what is the best way to make my structure available to the other .exe.
Can l share a simple pointer to my structure thru QsharedMemory ? and retrive it from the other exe ?
any comments is greatly appreciated
regards,
Michael
Re: QsharedMemory or QsharedData ?
QSharedData is for sharing data between objects that are implicitly shared (copy-on-write) within a process. Sharing across processes is a QSharedMemory task. You can create() a chunk of memory to contain your shared data structure. Both processes can retrieve/store information in with appropriate use of lock(), unlock(), data(), and constData(). Passing a pointer between processes strikes me as a no-no though: the memory pointed to is part of the sending process and should not generally be accessible from another process.
Re: QsharedMemory or QsharedData ?
Hi Chris,
thanks for your quick answer ...so l should go with Qsharedmemory....but the structrure l want to share has pointers like " QList<a*> *b" initialized in my main .exe. Is there a way l can share this pointers/ data with my other .exe ?
regards,
Michael