G
Guest
Sirs
I have the foolowing structures in C
#define POLY_MAX 8 // Número máximo de lados em um polÃgon
typedef struct { // Um vértice do polÃgon
double u, v; // texture space coord
double sx, sy; // screen space coord
double x, y, z; // object space coord
} poly_vert
typedef struct { // um polÃgon
int n; // número de lado
poly_vert vert[POLY_MAX]
} poly
and I used this solution
C
[StructLayout(LayoutKind.Sequential, Pack=1)
public struct poly_ver
{
public Double u, v;
public Double sx, sy;
public Double x, y, z;
}
[StructLayout(LayoutKind.Sequential, Pack=1)
public struct poly // um polÃgon
{
public Int32 n; // número de lado
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)
public poly_vert[] vert
public poly (int N
n = N
vert = new poly_vert[4]
When I try to call this function in an exported Win32 DL
extern "C" __declspec(dllexport) int pmap_poly(poly *p, double ST[3][3])
C
[DllImport("ImageWarping.dll")
public static extern int pmap_poly(poly p, [In, Out] double[,] ST)
I get this error
An unhandled exception of type 'System.TypeLoadException' occurred in ImageWarpingClient.ex
Additional information: Can not marshal field vert of type poly: This type can not be marshaled as a structure field
Any help? How can I marshal the field vert
Thanks
Camil
I have the foolowing structures in C
#define POLY_MAX 8 // Número máximo de lados em um polÃgon
typedef struct { // Um vértice do polÃgon
double u, v; // texture space coord
double sx, sy; // screen space coord
double x, y, z; // object space coord
} poly_vert
typedef struct { // um polÃgon
int n; // número de lado
poly_vert vert[POLY_MAX]
} poly
and I used this solution
C
[StructLayout(LayoutKind.Sequential, Pack=1)
public struct poly_ver
{
public Double u, v;
public Double sx, sy;
public Double x, y, z;
}
[StructLayout(LayoutKind.Sequential, Pack=1)
public struct poly // um polÃgon
{
public Int32 n; // número de lado
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)
public poly_vert[] vert
public poly (int N
n = N
vert = new poly_vert[4]
When I try to call this function in an exported Win32 DL
extern "C" __declspec(dllexport) int pmap_poly(poly *p, double ST[3][3])
C
[DllImport("ImageWarping.dll")
public static extern int pmap_poly(poly p, [In, Out] double[,] ST)
I get this error
An unhandled exception of type 'System.TypeLoadException' occurred in ImageWarpingClient.ex
Additional information: Can not marshal field vert of type poly: This type can not be marshaled as a structure field
Any help? How can I marshal the field vert
Thanks
Camil