Marshaling byval C-structure as return value in C?

I repro. It has some kind of odd problem with the bool member in the structure. Replace it with byte and it will work.

Beware that there were a lot of mistakes in your code, I made this version work: using System; using System.Runtime. InteropServices; class Program { static void Main(string args) { Foo value = GetFoo(); } StructLayout(LayoutKind. Sequential) private struct Foo { public int a; public byte b; public int c; }; DllImport(@"c:\projects\consoleapplication3\debug\cpptemp10.

Dll", CallingConvention = CallingConvention. StdCall, CharSet = CharSet. Ansi, EntryPoint = "_GetFoo@0") private static extern Foo GetFoo(/*int CoreIndex*/); } typedef struct foo { int a; bool b; int c; } FOO,*LPFOO; extern "C" __declspec(dllexport) FOO __stdcall GetFoo() { FOO f; f.

A = 42; f. B = true; f. C = 101; return f; }.

Great! It works! The problem realy was in bool parameter.

Thank you very much! – Anton Semenov Jan 30 at 20:38.

I repro. It has some kind of odd problem with the bool member in the structure. Replace it with byte and it will work.

Beware that there were a lot of mistakes in your code, I made this version work.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions