473,405 Members | 2,338 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,405 software developers and data experts.

Getting Unmanaged struct data to C#

What is the best way to get a set of unmanaged structs to C#.

I have the following structs:
typedef struct
{
unsigned char Angle[4];
unsigned char Rayon[3];
} StructPointPolaire;
//---------------------------------------------------------------------------
typedef struct
{
StructPointPolaire PointPolaire[36];
}StructForme36Points;
....
typedef struct
{
StructForme36Points Forme36Points;
...//more structs with similar data
char FinFichier[3];
} StructFormatMo1;

StructFormatMo1 is inside an unmanaged c++ class for which I have a
managed wrapper. The structs are filed in the constructor.

I need to access StructFormatMo1 (and the structs inside of course) in
C#. I won't be modifying the data and sending back to the c++
objects.

Thank you very much,
John

Apr 27 '07 #1
1 2592

<jc******@gmail.comwrote in message
news:11**********************@c18g2000prb.googlegr oups.com...
What is the best way to get a set of unmanaged structs to C#.

I have the following structs:
typedef struct
{
unsigned char Angle[4];
unsigned char Rayon[3];
} StructPointPolaire;
//---------------------------------------------------------------------------
Use an unsafe C# struct with the fixed keyword.

C++ unsigned char corresponds to C# byte.
typedef struct
{
StructPointPolaire PointPolaire[36];
}StructForme36Points;
...
typedef struct
{
StructForme36Points Forme36Points;
...//more structs with similar data
char FinFichier[3];
} StructFormatMo1;

StructFormatMo1 is inside an unmanaged c++ class for which I have a
managed wrapper. The structs are filed in the constructor.

I need to access StructFormatMo1 (and the structs inside of course) in
C#. I won't be modifying the data and sending back to the c++
objects.

Thank you very much,
John

May 7 '07 #2

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

Similar topics

8
by: Don | last post by:
I have a third party C++ DLL that I am trying to use from C#. The specific function I am trying to use is declared in C++ as follows: ladybugConvertToMultipleBGRU32( LadybugContext ...
2
by: zDog | last post by:
I found a lot of information on passing data from C# to a C++ dll What I cannot find is a way to return C++ structs of TCHAR string data back to the C# managed code! typedef struct // C++ data...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
9
by: Burkhard | last post by:
I declared a struct with fixed size buffers to send it to an unmanaged function unsafe struct RCSTKAS { public fixed Byte xValue1 ; public fixed Byte xValue2 ; ... }
5
by: Andy | last post by:
I'm having trouble accessing an unmanaged long from a managed class in VC++.NET When I do, the contents of the variable seem to be mangled. If I access the same variable byte-by-byte, I get the...
6
by: bill | last post by:
All, I have an unmanaged data structure that I use to pass to an umanaged DLL written in C. This works great. The structure looks sort of like this: unsafe public struct Inputs { .....
6
by: Aston Martin | last post by:
Hi All, ********************** My Situation ********************** I am working on project that involves passing a structure to unmanaged code from .Net world (well using C#). Perhaps an example...
7
by: Tremendo | last post by:
Hi, I need to consume an unmanaged DLL from managed C#. The DLL is "ae766.dll". I have problems with one function in it. Who developed the DLL, provided the following information, regarding that...
16
by: pkoniusz | last post by:
Hello everybody, Been just thinking how actually one could convert the following unmanaged code to the managed C++: struct JustAnExample { char value1; int value2; // etc ....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.