Solved

how to pass an array as parameter to C function ??

Posted on 2003-11-03
1
305 Views
Last Modified: 2010-04-16
I have a DLL in C code (win32 DLL)

I want to use it in my C#.

the prototype of my C function :       int** allocation(int** r, int m, int n)

in my C#, i have made a DLLImport.
The return "work". In an usafe part i create an int**, ...

But i don't know how to create an int** and affect it in order to pass it in param

unsafe
                  {
                        int** tutu;
                        int** toto;

                        tutu = allocation(toto, 2, 2);     // toto is not assigned

                                                               .....
                                                  }

I can access to "tutu" after ... but assign "toto" ????

Is it the right way ? How create the array ?

Thanks
0
Comment
Question by:regdobey
1 Comment
 

Accepted Solution

by:
nicog76 earned 250 total points
ID: 9671803
In your DLLimport you had to put " [In] int[,] " for the int*, and use an int[,] in safe.

good luck
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question