Bonjour,
j'essais de wrapper une fonction d'une DLL C en C#.

j'ai cette erreur :
Not enough storage is available to complete this operation.

Je pense que j'ai un problème sur le wrapping des arguments de type byte[][] mais je ne vois pas comment faire autrement.

(PS: en Debug je n'arriva pas à aller dans le natif)


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Natif : ConversionLibrary.h
 
#define CSCEXP  __declspec(dllexport)
 
extern "C" CSCEXP int CSC_ConvertPkIsoToPkMat2(
	BYTE			*i_Buffer,
	unsigned int	i_BufferSize,
	BYTE			**o__FirstFinger,
	int				*o__FirstFingerPosition,
	BYTE			**o__SecondFinger,
	int				*o__SecondFingerPosition
	);
 
 
Natif : ConversionLibrary.cpp
CSCEXP int CSC_ConvertPkIsoToPkMat2(
		BYTE			*i_Buffer,
		unsigned int	i_BufferSize,
		BYTE			**o__FirstFinger,
		int				*o__FirstFingerPosition,
		BYTE			**o__SecondFinger,
		int				*o__SecondFingerPosition
			)
{
	....
}
 
 
Manager tes.cs
 
[DllImport("ConversionLibrary.dll", SetLastError = true)]
        private static extern int CSC_ConvertPkIsoToPkMat2(
            byte[] i_Buffer,
            uint i_BufferSize,
            byte[][] o__FirstFinger,
            ref int o__FirstFingerPosition,
            byte[][] o__SecondFinger,
            ref int o__SecondFingerPosition
            );
 
 
 
public static int test()
{
try
{
        byte[][] l__PkMat1 = new byte[10][];
        byte[][] l__PkMat2 = new byte[10][];
 
        for (int l_Index = 0; l_Index < 10; l_Index++)
        {
            l__PkMat1[l_Index] = new byte[512];
            l__PkMat2[l_Index] = new byte[512];
        }
 
	CSC_ConvertPkIsoToPkMat2(
                    i_Buffer,
                    i_BufferSize,
                    l__PkMat1,
                    ref o_FingerPosition1,
                    l__PkMat2,
                    ref o_FingerPosition2
                    );
 
}
catch (Exception e)
{
}
}