I am trying to convert C# project to Delphi, the C# code itself is importing functions from native dll let us name it ‘dmp.dll’ which I don’t have the signature of its native functions and I have to look at how these functions are imported in c# and try to import them in Delphi code, and I did import a lot of them and they work fine, but now I am struggling with this function (StartLogging
). This is how they imported in C#:
[DllImport("dmp.dll", CharSet = CharSet.Auto, EntryPoint = "StartLogging")]
public static extern int StartLogging(String AdapterName,
PLOG_RECORD_CALLBACK LogRecordCallback,
SafeWaitHandle StopLoggingEvent);
no problem about PLOG_RECORD_CALLBACK
, but the problem is on this parameter SafeWaitHandle
which is class exists in Microsoft.Win32.SafeHandles
namespace. How can I port it to Delphi? What is the equivalent data type to it in Delphi?
And here is how they use it in the C# Code:
AutoResetEvent StopEvent = new AutoResetEvent(false);
The class AutoResetEvent
exists in System.Threading
Then they call the method like this:
StartLogging(comboBox1.Text, CallbackProcedure, StopEvent.SafeWaitHandle);
Then at the last and to stop the logging they use:
StopEvent.Set();
I am really confused and I don’t know how to do this, appreciate your help. Thanks