Good afternoon,
i am currently wrestling with an old .dll which functionality I have to re-use in a .Net application & I came so far to import the basic/easy functions/methods that return bool etc, but some do in fact also expect (or return) an type that is declared within the .dll.
How would I handle this? How would I map/create that type in my .net environment?? Is that possible at all?
Cheers and thanks,
-Jörg
By “type”, I assume you mean struct, otherwise you’ll have to find out how to map a struct in memory to your type.
You’ll have to create the same struct in your .NET application, and mark it with the
StructLayoutattribute (LayoutKind.Sequentialis the most common). Then you should be able to pass a reference to the struct.The Platform Invoke Tutorial on MSDN is also quite helpful.