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

How to pass pointer to pointer to c function from c#

I am trying to access C function from C#. I have made DLL of C Code. I have
exported function to be caled using DEF file. defination of the function I
want to call is have one of the parameter is "Pointer to Pointer to Short"

I want to Pass 2D Array to this function as pointer to pointer. I can send
Single dimention array to C function and it works fine. For passing single
dimention array example has been given in MSDN. Please find URL below

FOR PASSING ARRAYS(URL):
"ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconarrayssample.htm"
the example which I am using for sending singe dimention array is
"TestArrayOfInts" in above document URL

I want to Pass 2D array the same way

----------------------------------------------------------------------------
----

C Fucntion

----------------------------------------------------------------------------
----

void DblArray(short **arrayPassed)
{

*(arrayPassed[0]) += 100;
*(arrayPassed[0] + 1) += 200;
*(arrayPassed[0] + 2 ) += 300;

*(arrayPassed[1]) += 10;
*(arrayPassed[1] + 1) += 20;
*(arrayPassed[1] + 2 ) += 30;

}

----------------------------------------------------------------------------
----
The code should be able to call above function by passing 2D array as
**arrayPassed. The values of array (in C#)
[0][0],[0][1],[0][2],[1][0],[1][1] and [1][2] will be changed by C function.
E.G. value of (array in C#) [1][1] element will be incremented by 20.

Thanks in advance.

Nov 15 '05 #1
0 1155

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

Similar topics

110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
14
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is...
6
by: lisp9000 | last post by:
I've read that C allows two ways to pass information between functions: o Pass by Value o Pass by Reference I was talking to some C programmers and they told me there is no such thing as...
11
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible...
4
by: S. | last post by:
Hi all, I have the requirement that I must pass-by-reference to my function addStudent() and getAge() functions where my getAge() function is within the addStudent() function. I am able to...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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
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.