interop question

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>
 
L

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top