I actually tried the ref and alloc route, but that didn't work.
Good to know that out goes with **. I'll switch back to using ref and
allocing the struct while I continue to look for the source of the problem.
Any other thoughts?
Thanks,
-Mont
On 4/24/07, Stoyan Damov <[EMAIL PROTECTED]> wrote:
> void flxActCommonHandleGetError(FlxActHandle handle, FlxActError
*err);
> private static extern void flxActCommonHandleGetError(handle,
out
> ActivationError error);
It could have been an out param if err was FlxActError** but since
it's not you probably have to allocate the structure and pass it by
reference like that:
private static extern void flxActCommonHandleGetError(IntPtr handle,
ref ActivationError error);
public ActivationError GetLastError()
{
ActivationError error = new ActivationError();
flxActCommonHandleGetError(Handle, ref error);
return error;
}
Haven't tried it though.
On 4/25/07, Mont Rothstein <[EMAIL PROTECTED]> wrote:
> I am trying to get a struct from a function in a DLL, but I always get
zero.
>
> The below code always leaves the struct with 0 as the value for each
> parameter in the struct though the equivalent C code populates the
values.
>
> Does anyone see what I am missing?
>
> Thanks,
> -Mont
>
> Here is what I have:
>
> C definitions:
>
> typedef struct {
> uint32_t majorErrorNo;
> uint32_t minorErrorNo;
> uint32_t sysErrorNo;
> } FlxActError;
>
> void flxActCommonHandleGetError(FlxActHandle handle, FlxActError
*err);
>
>
> public struct ActivationError
> {
> public uint majorError;
> public uint minorErrorNo;
> public uint systemErrorNo;
> }
>
>
> C# definition and function call:
>
> [DllImport("mydll.dll", CharSet = CharSet.Ansi)]
> private static extern void flxActCommonHandleGetError(handle,
out
> ActivationError error);
>
> public ActivationError GetLastError()
> {
> ActivationError error;
>
> flxActCommonHandleGetError(Handle, out error);
>
> return error;
> }
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>
--
Cheers,
Stoyan
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com