- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At present, a file/file mapping is created for each of these arrays, which I find a little messy (why use four files?). Could I put these arrays in a TYPE and still have pointers to each array? Or am I asking for trouble?
Dan
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you can put them in a TYPE and have a pointer only to a TYPE -- the references will be automagically resolved once you get a pointer to the type so that you can refer to them as T%a_shared_item, etc.
If you prefer not to refer to them as T%a_shared_item, you can have that too -- just define a pointers as you have now but do not dereference them using shared memory but rather as:
p_dy_item = LOC(T%a_shared_item)
a_shared_item(1)= something
!same asT%a_shared_item(1) = something
This will work only if the arrays are normal, static components of T -- not if they're POINTERs or ALLOCATABLEs.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Certainly. I do it all the time. (If you're familiar with Win32, take a look e.g. at NMHDR argument of WM_NOTIFY message).
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK...I got it going with a TYPE, which is great. But I notice my process is now leaking handles when I run the memory sharing model. Obviously I need to CLOSEHANDLE my file handles, but what about UnMapViewOfFile? Presumably that needs to be called after the data is read/written? (You can probably tell I'm kinda making this up as I go along...!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quote from remarks section of CreateFileMapping entry:
To fully close a file-mapping object, an application must unmap all mapped views of the file-mapping object by calling UnmapViewOfFile, and close the file-mapping object handle by calling CloseHandle. The order in which these functions are called does not matter. The call to UnmapViewOfFile is necessary because mapped views of a file-mapping object maintain internal open handles to the object, and a file-mapping object will not close until all open handles to it are closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok...thanks Jugoslav...I stuck in some CLOSEHANDLEs and an UNMAPVIEWOFFILE and my handle leak appears to have gone away!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page