Results 1 to 3 of 3

Thread: QsharedMemory or QsharedData ?

  1. #1
    Join Date
    Sep 2009
    Location
    phoenix, AZ
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default 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.

  3. #3
    Join Date
    Sep 2009
    Location
    phoenix, AZ
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

Similar Threads

  1. QSharedMemory and C++ objects
    By MattPhillips in forum Qt Programming
    Replies: 7
    Last Post: 29th November 2010, 07:42
  2. about the QSharedMemory
    By banban0802 in forum Qt Programming
    Replies: 5
    Last Post: 10th August 2010, 12:08
  3. new vs QSharedMemory
    By JovianGhost in forum Qt Programming
    Replies: 2
    Last Post: 17th March 2010, 00:34
  4. QSharedMemory won't attach
    By MattPhillips in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2009, 15:45
  5. QSharedData - implicit sharing
    By gyre in forum Newbie
    Replies: 4
    Last Post: 28th October 2007, 19:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.