Click here to Skip to main content
15,920,031 members
Home / Discussions / C#
   

C#

 
QuestionPolymorphism Pin
Ram_Bytes21-Aug-08 5:44
Ram_Bytes21-Aug-08 5:44 
AnswerRe: Polymorphism PinPopular
Dan Neely21-Aug-08 7:03
Dan Neely21-Aug-08 7:03 
JokeRe: Polymorphism Pin
Manas Bhardwaj21-Aug-08 7:19
professionalManas Bhardwaj21-Aug-08 7:19 
GeneralRe: Polymorphism Pin
Dan Neely21-Aug-08 7:46
Dan Neely21-Aug-08 7:46 
GeneralRe: Polymorphism Pin
Kevin McFarlane22-Aug-08 0:33
Kevin McFarlane22-Aug-08 0:33 
GeneralRe: Polymorphism Pin
Yusuf21-Aug-08 8:30
Yusuf21-Aug-08 8:30 
GeneralRe: Polymorphism Pin
vikas amin21-Aug-08 10:09
vikas amin21-Aug-08 10:09 
GeneralRe: Polymorphism Pin
Ravi Bhavnani21-Aug-08 13:50
professionalRavi Bhavnani21-Aug-08 13:50 
GeneralRe: Polymorphism Pin
ChandraRam21-Aug-08 20:49
ChandraRam21-Aug-08 20:49 
AnswerRe: Polymorphism Pin
Manas Bhardwaj21-Aug-08 7:18
professionalManas Bhardwaj21-Aug-08 7:18 
AnswerRe: Polymorphism Pin
Robert.C.Cartaino21-Aug-08 7:21
Robert.C.Cartaino21-Aug-08 7:21 
AnswerRe: Polymorphism PinPopular
led mike21-Aug-08 8:40
led mike21-Aug-08 8:40 
QuestionHow do I change the datagrid.readonly property at run time Pin
krissree21-Aug-08 4:51
krissree21-Aug-08 4:51 
AnswerRe: How do I change the datagrid.readonly property at run time Pin
dan!sh 21-Aug-08 5:15
professional dan!sh 21-Aug-08 5:15 
AnswerRe: How do I change the datagrid.readonly property at run time Pin
Manas Bhardwaj21-Aug-08 5:23
professionalManas Bhardwaj21-Aug-08 5:23 
AnswerRe: How do I change the datagrid.readonly property at run time Pin
Dan Neely21-Aug-08 10:43
Dan Neely21-Aug-08 10:43 
QuestionHow do I change the datagrid.readonly property at run time Pin
krissree21-Aug-08 4:50
krissree21-Aug-08 4:50 
AnswerRe: How do I change the datagrid.readonly property at run time Pin
Yusuf21-Aug-08 8:32
Yusuf21-Aug-08 8:32 
Questionref a struct in a DLLImport function Pin
indogerman21-Aug-08 4:48
indogerman21-Aug-08 4:48 
AnswerRe: ref a struct in a DLLImport function Pin
led mike21-Aug-08 5:09
led mike21-Aug-08 5:09 
AnswerRe: ref a struct in a DLLImport function Pin
oobimoo21-Aug-08 7:12
oobimoo21-Aug-08 7:12 
AnswerRe: ref a struct in a DLLImport function Pin
Gideon Engelberth21-Aug-08 17:19
Gideon Engelberth21-Aug-08 17:19 
GeneralRe: ref a struct in a DLLImport function Pin
indogerman24-Aug-08 21:58
indogerman24-Aug-08 21:58 
GeneralRe: ref a struct in a DLLImport function Pin
Gideon Engelberth25-Aug-08 2:35
Gideon Engelberth25-Aug-08 2:35 
You can declare a structure in C#, but if you are going to use it for PInvoke, you need to use an attribute to make sure it gets laid out correctly. It should be:

using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential)]
public struct device_info_t
{
    public int size;
    ....
}


Then make sure you declare the fields in the structure in the same order as in the header file.

Also, I would try changing the signature of the function definition. Even if the size_t structure fits in an integer, I would go ahead and define it anyway to be safe.

Original:
int GetSearchResults(const handle_t handle, device_info_t results[], const size_t count);

C#
int GetSearchResults(IntPtr handle, device_info_t results[], size_t count);
QuestionHow to Use DataSet in C# Pin
mghiassi21-Aug-08 4:26
mghiassi21-Aug-08 4:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.