Home All Groups Group Topic Archive Search About
Author
20 Dec 2005 5:56 AM
Lloyd Dupont
I have a C API like that:
==== C-API.h ====
typedef double NSTimeInterval;
NSTimeInterval GetTimeSince1970();
===============

Now I have a code generator parsing the headers and automatically
generating:
==== Generated.cs ====
class Wrapper
{
    [DllImport(...)]
    public extern static NSTimeInterval GetTimeSince1970();
}

where
[StructLayout(LayoutKind.Sequential)]
struct NSTimeInterval
{
    public seconds timeinterval;
}
========

but that doesn't seem to work.
while the C call return correct value, C# test return me stupid random like
value.

what's even weirder I think it used to work well, the only breaking change I
could see is that I'm now using .NET 2.0 final release.

Any tips/thoughts?

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>

Author
20 Dec 2005 7:25 AM
Lloyd Dupont
in fact my wrapper is in managed C++.
I just redefined NSTimeInterval as it is in the (missing) C header and it
works nicely!

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
Show quote
"Lloyd Dupont" <net.galador@ld> wrote in message
news:%23bEbzoSBGHA.1180@TK2MSFTNGP09.phx.gbl...
>I have a C API like that:
> ==== C-API.h ====
> typedef double NSTimeInterval;
> NSTimeInterval GetTimeSince1970();
> ===============
>
> Now I have a code generator parsing the headers and automatically
> generating:
> ==== Generated.cs ====
> class Wrapper
> {
>    [DllImport(...)]
>    public extern static NSTimeInterval GetTimeSince1970();
> }
>
> where
> [StructLayout(LayoutKind.Sequential)]
> struct NSTimeInterval
> {
>    public seconds timeinterval;
> }
> ========
>
> but that doesn't seem to work.
> while the C call return correct value, C# test return me stupid random
> like value.
>
> what's even weirder I think it used to work well, the only breaking change
> I could see is that I'm now using .NET 2.0 final release.
>
> Any tips/thoughts?
>
> --
> Regards,
> Lloyd Dupont
>
> NovaMind development team
> NovaMind Software
> Mind Mapping Software
> <www.nova-mind.com>
>

AddThis Social Bookmark Button