Sharing Global stuctures between VB.net and C++.net or C#.Net

  • Thread starter Thread starter Islay Rodriguez Jr.
  • Start date Start date
I

Islay Rodriguez Jr.

How do you share glogal data stuctures between VB.net and C++ or C# ?

Thanks,
Islay
 
Islay Rodriguez Jr. said:
How do you share glogal data stuctures between VB.net and C++ or C# ?

You can do that via a memory-mapped file (p/invoke), for example.
 
Does this method require I/O to the disk every time a variable in the data
structure is accessed?

I'm look for something that will allow access to the variables in the
structure, as if they static to each of the routines (vb.net and C++). Parts
of the stucture has large buffers for DMA data that is not required on
disk,it only needs to be avalible in memory. Other variables are modified
dynamicaly in other threads and must be instantly avalible to other routines
in different threads.
 
Hi Islay,

Accessing data in the mapped file will not cause IO to the disk every time,
the mapped view of the file resides in memory. See:
http://msdn2.microsoft.com/en-us/library/aa366556(VS.85).aspx

To use file mapping as a communication channel of different processes, you
can create a named shared memory (by passing INVALID_HANDLE_VALUE and a
name to CreateFileMapping), the system will use the paging file as data
storage. See: http://msdn2.microsoft.com/en-us/library/aa366551(VS.85).aspx

There are other means of IPC (Inter Process Communication), see:
http://msdn2.microsoft.com/en-us/library/aa365574.aspx


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks Walter for your reply,

My real problem is that I have a large mixed language project (legacy code)
that needs to be converted from Compact Visual Fortran and Microsoft Visual
C++ to .NET. In the legecy code, several large fortran common block are
shared between fortran code and the C++ code using global structures. I've
been told that there may be problems with tring to do this (sharing common
blocks/data structure) in VB.NET or even C++.NET.

The memory mapped file would require me to rewrite most of the fortran code
since I won't be able to use the common block data. I would have access the
data with pointers.

So apparently mapping C++ global data structures to fortran common blocks at
link time no longer is possible in .NET?
 
Hi Islay,

I'm not familiar with Fortran, therefore my understanding of this issue
might not be complete. What was your previous approach? Do you mean shared
data section using "#pragma data_seg" in Visual C++? I think you can still
use this approach in .NET application, but only with managed C++ (C++/CLI),
you cannot do this for C# or VB.NET. See the last FAQ here:
http://msdn.microsoft.com/msdnmag/issues/03/06/CQA/


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

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