Trying to marshal a float[,]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coriscow
    New Member
    • Feb 2008
    • 5

    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 ( "JanitorMobiled ll.dll", EntryPoint = "capture_in put" )]
    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.cap ture_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!!!!
Working...