473,386 Members | 1,693 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.

convert IntPtr to float **

Hi all
I have to use unmanaged COM from .Net environment. This component does
some calculations on a two dimensional array of data and returns
another two dimentional array of processed data.
I've added a reference to this COM. Then I've instantiated an object
of its type. Now I want to call a ProcessData method of this object.
ProcessData method in the original C++ expects float** type as a
parameter (which is a two dimentional array of floats). I've tryed to
do something like this:

int [,]arrRaw1={{2,2,2},{3,3,3}};
int [,]arrFiltered1;
IntPtr arrRaw;
IntPtr arrFiltered;
Marshal.StructureToPtr(arrRaw1,arrRaw,true);
obj.ProcessData(arrRaw,arrFiltered);
Marshal.PtrToStructure(arrFiltered,arrFiltered1);

It does not work.
How to pass multidimentional array to/from unmanaged code?
Thanks for your help,
Lisa.
Nov 16 '05 #1
2 5506
PreserveSigAttribute
Nov 16 '05 #2

Hi Peter,
Thanks for the answer.
I have this definition in the .tlb file:
[in, size_is(4, theDataLength)] float** theRawData,
[in, out, size_is(4, theDataLength)] float** theFilteredData,
I was trying to put definition like this in the .il file:
[in] float64[,] marshal([]) theRawData,
[in][out] float64[,] marshal([]) theFilteredData,
It compiles and runs, but when the COM object code is reaching this
line:
float a = theRawData[0][0];
it throws the System.NullReferenceException
How should I define 2-dimentional array of floats?
Thanks for your help,
Lisa.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

5
by: Cally | last post by:
Hello, I would like to convert a field from ntext field found in one database table to float field found in another database table. The reason why I want to do this is a long one. I have...
3
by: MJB | last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would like to convert this to a System.IO.Stream in order to work with it in my application. Has anyone encountered this and...
1
by: Vinoth Kumar | last post by:
Hi I am writing a wrapper class for a unmanaged c++ class, which has the method signature, Method(wchar_t** ppszValue) Anyone please tell me, how to convert the string _gc* _gc* to...
1
by: Mad Scientist Jr | last post by:
hi can someone possibly convert this to vb.net ? it is c# code that lets the pocket pc access the voice recorder... many thanks... source: wapboy...
5
by: Sakharam Phapale | last post by:
Hi All, I am using Microsoft Speech DLL "sapi.dll". I want to use following method of "SpeechLib.SpStream" object (following is a signature which I copied from Quick Info feature of .NET code...
14
by: Me | last post by:
Hi all I am getting a really bizzare error on when I convert a string into a datetime: The code is : DateTime dt1 = Convert.ToDateTime("10 Sep 2005"); Console.WriteLine(dt1.Year);
1
by: omariqbalnaru | last post by:
Can anybody please explain to me what the statment floatptr=(float*) intptr; does?
8
by: Serge BRIC | last post by:
My application, written in .NET VB, tries to get a communication port handle from a TAPI object with this code: Dim vFileHandle As Byte() = appel.GetIDAsVariant("comm/datamodem") The...
9
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i am a little stuck here, how do i convert this from C Structure to an structure in C# that can be marshalled: typedef struct _DEV_BROADCAST_DEVICEINTERFACE { DWORD dbcc_size; DWORD...
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...
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
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.