Shared Memory Questions

G

Guest

Hi

I used shared memory quite a lot for IPC. The problem is that it is fixed
size so that you cannot place something like a CString in it because CString
will load it's buffer from the local heap which will mean nothing to another
program accessing the pointer.

I was wondering if any of the new CStringT type items or STL "string"
objects can be declared so that the storage is fixed at declaration time. I
hate using char[], but I have no choice it seems.

It would be really fun to set up a shared heap using a memory manager with
mutexes, etc. I looked at ACE, but there seems to be a lot baggage.

I'm converting VC 6.0 MFC apps to VC 7.0 and beyond, maintaining MFC for the
most part.

Thanks

Bill
 
G

Gary Chang[MSFT]

Hi Bill,
I was wondering if any of the new CStringT type items or STL "string"
objects can be declared so that the storage is fixed at declaration time.

The new CStringT in VC7 is a template class used to manipulate
variable-length character strings by default. The memory to hold these
strings is allocated and released through a string manager object,
associated with each instance of CStringT.

These default string types use a string manager that allocates memory from
the process heap (in ATL) or the CRT heap (in MFC). However, you can
override the default memory management behavior of CStringT, creating
allocators specifically customized to your requirement. For more detaled
infor and related topics, please refer to the following MSDN links:

Memory Management and CStringT
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html
/vcconMemoryManagementCStringT.asp


Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top