Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have .dll which developed by C++.
I have simple function linkw this.
C++
Get_struct_data(struct_def *def, long* size)

*def is array of struct_def.


After I added .dll to C# project by using 'Add Reference..'.
The interfaces for C# is
C#
Get_struct_data(out struct_def def, out long size)


But I expect
C#
Get_struct_data(out struct_def def[], out long size)


This make me can't use function from dll.
Is any one know how can I fix this?


Thank in Advances.

What I have tried:

I did check on Google for a day but not see anyone talking about thins.
Posted
Updated 17-Mar-18 23:17pm
v2

Use the marshalling as described in Richards link. A qucick solution is often to make a plain data interface with only using integrated data types like integers and strings.

Allocate the struct and all data in the runtime where you want to use it, so make everytime a local copy.

I have some working code provided in an article I wrote to help on such questions.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900