473,386 Members | 1,733 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,386 software developers and data experts.

Unmanaged Struct Array Pointer

Hello,

I want to use this C++ method in C#:

int doSomething(MyStruct*** structArray);

MyStruct is a struct and MyStruct *** is a pointer to an array of
pointer of my structs.

How can I use that in C#?

I have the struct definded in C# but this doesn't work:

[DllImport("MyDll.dll")]
public static extern int doSomething(ref MyStruct [] structArray);

Help please.

bye bembi

Apr 18 '06 #1
2 2192
>I have the struct definded in C# but this doesn't work:

[DllImport("MyDll.dll")]
public static extern int doSomething(ref MyStruct [] structArray);


Is it an input and/or output array and how long is it? This may or may
not work

public static extern int doSomething(ref IntPtr[] structArray);
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Apr 18 '06 #2
It works!

Thank you so much!

bye bembi

Apr 20 '06 #3

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

Similar topics

11
by: Tim | last post by:
Why won't the declaration of a struct array work if I do it like this: 1 typedef struct 2 { 3 int pens; 4 int pencils; 5 } Stationers; 6 .........
1
by: SleepSheep | last post by:
two struct in c# public class A { int i1; byte i2; }
1
by: Ryu, Kyoung-Seok | last post by:
I read brilliant ManWrap Lib article in MSDN Mag (http://msdn.microsoft.com/msdnmag/issues/05/04/C/default.aspx) I'm making Internet Authenticatioin Server Extension DLL This DLL must be only...
1
by: Lee Crabtree | last post by:
I have several unmanaged struct types that I've created equivalent managed struct types for. How do I marshal the managed structs into their unmanaged versions and vice versa? Here's a quick...
5
by: s88 | last post by:
Howdy: the follows is my program, I wanna change my structure array pointer in the function "testfunc", but I fail..., I also try to call the testfunc by reference, but the compiler says...
2
by: symbol | last post by:
I am having this problem in a managed c++ DLL which mixes managed and unmanaged C/C++ code. I tried to assign value to a struct array nested in another struct. but I can only write to the first...
1
by: symbol | last post by:
I am having this problem in a managed c++ DLL which mixes managed and unmanaged C/C++ code. I tried to assign value to a struct array nested in another struct. but I can only write to the first...
1
by: DaTurk | last post by:
I'm having an issue converting an unmanaged struct to a CLI managed struct. It's a value struct and this cannot be changed. public value struct UpdateItem { public: System::String ...
0
by: yrd | last post by:
I need to use a 'C' Dll with the following function: int DoSomthing(char * p_intput, MYSTRUCT** p_output) My C# defining is: private static unsafe extern int DoSomthing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.