473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Best structure to use for interoperability

Hi,

I have to pass an array containing a structure from a C# library to a C DLL.
Which is the best way to do it? Hashtable or ArrayList or anyother better
way.

Also, how do i marshal and then retreive the data at the C end.

Thanks
Nov 16 '05 #1
3 1390
GeRmlc,

How is the array declared in the structure? If it is embedded in the
structure, then you can just declare it as an array and attach the MarshalAs
attribute to the field, specifying ByValArray as the UnmanagedType (and the
size as well).

If it is a pointer to an array, then you will have to marshal this
yourself, and manage the memory yourself.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"GeRmIc" <Ge****@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
Hi,

I have to pass an array containing a structure from a C# library to a C
DLL.
Which is the best way to do it? Hashtable or ArrayList or anyother better
way.

Also, how do i marshal and then retreive the data at the C end.

Thanks

Nov 16 '05 #2
Hi,

My structure is like this

public struct LMS
{
public long a;
public long b;
....etc.,
}

and i have to pass an array containing such structures to a calling C
program. The array will be a variable one, as the number of such structures
returned by the logic cannot be determined during design time.

Help.
Thanks!
Nov 16 '05 #3
Hi,

My structure is like this

public struct LMS
{
public long a;
public long b;
....etc.,
}

and i have to pass an array containing such structures to a calling C
program. The array will be a variable one, as the number of such structures
returned by the logic cannot be determined during design time.

Help.
Thanks!
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: j-integra_support | last post by:
Looking for Java/COM interoperability tools? Thousands of companies world-wide are using J-Integra for COM for interoperability between Java and Microsoft COM applications. J-Integra for COM is a...
4
by: Frederik Kesting | last post by:
Hi! I heard about the possibilty of using different languages for one project whith the .Net Framework. Is it f.e. possible to include Managed C++ code into a VB.Net project without changing...
3
by: sb | last post by:
I think streams are nice, but what do you do when you have to write to or, even worse, read from a FILE*, for example a UNIX stream? C++ streams can not be created from FILE*'s or have them...
1
by: louis | last post by:
Today I got the latest propaganda email from MSFT talking about XML and interoperability. It's been bothering me all day and while the notion of interoperability is good -- the ability to interact...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
1
by: GeRmIc | last post by:
Hi, I have to pass an array containing a structure from a C# library to a C DLL. Which is the best way to do it? Hashtable or ArrayList or anyother better way. Also, how do i marshal and then...
5
by: Alfonso Morra | last post by:
Hi, I am a C/C++ developer of quite a few yesrs, although I am relatively new to Windows (Unix background). I am about to begin work on a project that would require me to develop several GUI...
0
by: j-integra_support | last post by:
Looking for Java/.NET/CORBA interoperability tools? Intrinsyc Software has just released the latest addition to its popular J-Integra Interoperability Suite... J-Integra Espresso! J-Integra...
2
by: Anil Pundhir | last post by:
What is the best way to pass data to a web service. The client(to send data) has .net environment and also the server on which the web service is hosted also has the .net environment. Should I...
0
by: Pradnya Patil | last post by:
Hi , I need to export some of the reports to MS EXCEL & MS WORD in a WEB APPLICATION.I also need to LOCK some of the Columns in EXCEL-sheet.Right now I need to run the Interoperability...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.