interop question

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

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>
 
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>
 
Back
Top