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

Trying to marshal a float[,]

Hi all!!

I am developing an app for a Pocket PC platform on C#. However, I need to make use of a C written dll. The problem arises when calling the function
.........
int capture_input( float32 ***cepstrum, int nrOfSeconds, int playBack, int *nrOfCoeff );
.........

where it returns an int (not an error code), a bidimensional array allocated within the function (cepstrum) and another integer (nrOfCoeff). I call the function from C# managed code using the following declaration and code:

.........
[DllImport ( "JanitorMobiledll.dll", EntryPoint = "capture_input" )]
private static extern int capture_input ( float[,] cepstrum, int nrOfSeconds,
int playback, ref int nrOfCepstra );
.........
int numberOfFrames = 0;
int numberOfCepstra = 0;
float[,] cepstrum;
.........
numberOfFrames = JHandShaker.capture_input ( cepstrum, maxNrOfSeconds, 1, ref numberOfCepstra );
.........

The problem arises in the unmanaged code when redirecting the received pointer to the allocated memory region (*cepstrum=tmp_cep;).

What am I doing wrong??

Thanks!!!!
Feb 14 '08 #1
0 889

Sign in to post your reply or Sign up for a free account.

Similar topics

26
by: Olaf Baeyens | last post by:
I am trying to port some C++ structures to C# but I have troubles with this one. Note: this is a file record, so I must keep this format. #pragma pack( push, 1 ) typedef struct { char title; ...
13
by: Just Me | last post by:
The following almost works. The problem is Marshal.PtrToStringAuto seems to terminate at the first null so I don't get the full string. Any suggestions on how to fix this? Or how to improve the...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
14
by: Vertilka | last post by:
I need to read binary data file written by C++ program, using my C# application. How do i marshal the bytes i read with my C# code to .NET types. The data is numbers (integers float doubles...
6
by: william.thorpe.b | last post by:
I have recently switched from VS2003 to VS2005 and at the same time from V1 to V2 of the .NET Compact Framework. The target is a Windows CE 5.0 device and an ARMV4I processor. ...
4
by: dvir | last post by:
Hi I have a runing error while trying to initialize a class. this is my code: main.C ------------- #include "tdagent.H" #include "simple_env.H" #include <vector>
2
by: Pierre Rouleau | last post by:
Hi all, When using Python 2.4.x on a Win32 box, marshal.loads(marshal.dumps(1e66666)) returns 1.0 instead of infinity as it should and does under Python 2.5 (also running on Win32 ). This...
5
by: Anurag | last post by:
I have been chasing a problem in my code since hours and it bolis down to this import marshal marshal.dumps(str(123)) != marshal.dumps(str("123")) Can someone please tell me why? when...
3
by: coriscow | last post by:
Hi all!! I am developing an app for a Pocket PC platform on C#. However, I need to make use of a C written dll. The problem arises when calling the function ......... int capture_input( float32...
0
by: xrxst32 | last post by:
Hello there, I have some doubts about the best practice for using COM automation, the Runtime Callable Wrapper (RCW) and Marshal.ReleaseComObject. So the question is/are: Do I need to release...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.