Passing struct to dll with int array 
Author Message
 Passing struct to dll with int array

Hi!

I have an old dll, which have the following declaration:

int DLL_EXPORT ProcessImage(unsigned char *pImageBuffer,
  RES_STRUCT *pRes_Struct);

typedef struct {
  int StructSize;
  int Version;
  char result[100];              
  int *result_pos;  <- the dll set this value back
  int chrConf[10];              

Quote:
} RES_STRUCT;

My question: how can i call this from C# ???

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Tue, 02 Mar 2004 23:15:20 GMT  
 Passing struct to dll with int array

[StructLayout( LayoutKind.Sequential)]
public class ResStruct
{
public int StructSize;
public int Version;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=100)]
public byte[] result;
public IntPtr result_pos;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=10)]
public int[] chrConf;

Quote:
}

[DllImport("TheOld.dll", CharSet=CharSet.Auto)]
private static extern int ProcessImage( byte[] pimgbuf, [In, Out] ResStruct pres );

 NETMaster
 http://www.cetus-links.org/oo_csharp.html

I've been "encouraged" to share this helpful information from my lawyers:
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
? 2001 NETMaster. All rights reserved.

Quote:

> I have an old dll, which have the following declaration:

> int DLL_EXPORT ProcessImage(unsigned char *pImageBuffer,
>   RES_STRUCT *pRes_Struct);

> typedef struct {
>   int StructSize;
>   int Version;
>   char result[100];
>   int *result_pos;  <- the dll set this value back
>   int chrConf[10];
> } RES_STRUCT;



Wed, 03 Mar 2004 01:50:49 GMT  
 Passing struct to dll with int array
Many thanx!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 03 Mar 2004 03:41:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing array of struct to dll (again)

2. native dll calling with structs containing arrays of nested structs

3. how do I pass int array by reference?

4. passing of pointers to int arrays?

5. Passing an int array through argv WAS: my own Very revised aueston

6. array of Struct passing into a function

7. Array of struct pass to function

8. How to pass a struct to an unsigned char array

9. Passing array of struct

10. Passing a struct with an array to C++ function

11. passing adress of second element in array of structs

12. How to pass a struct to an unsigned char array

 

 
Powered by phpBB® Forum Software