Marshalling a Delphi enum

Hello, /r/csharp !

The project I'm currently working on requires the usage of a third-party DLL written in Delphi.

One of the custom types used by that DLL is something that looks really similar to an enum, or a set:

tStatus = (StatusOne, StatusTwo, StatusThree);

One of the methods that are exposed by the DLL has the return type tStatus.

I know it's a bad design choice by the developers (I also had to mashall Delphi's ShortString and another custom structure), but I cannot change that.

I tried to use an int, a C# enum, etc but with no luck.

So, how is that mashalling supposed to be done?

Thanks!

by isddhs via /r/csharp

Leave a Reply