I am trying to call C# APIs from python script, while doing so, I face TypeError, saying the API, that I am trying to call via python doesn't exist. I have verified the .dll to be present in the path, and is of proper format(32 bit).Below are the details - i have added only the portions, i think to be relevant for this.
C#
Signature of C# function I am trying to call
public status Initialization(SampleClass.CallbackDelegate callback, ushort Entries)
present in class SampleClass
where callback is of type
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void CallbackDelegate(IntPtr pData, SampleClass.eLogOpt bption, SampleClass.LogEntry_t[] pEntries);
test.py
def loggercallback(ptr:pointer, option:LogObj.eLogOption, entry:LogObj.LogEntry_t):
print(ptr)
print(option)
print(entry)
print(clr.FindAssembly("libnet"))
csharp_rdr = clr.AddReference("libnet")
from libnet import Log
from libnet import *
SampleClassObj = SampleClass()
fp_loggercallback = loggercallback
SampleClassObj.Initialization(fp_loggercallback,32)
ERROR MSG:
While executing test.py
SampleClassObj.Initialization(fp_loggercallback,32)
TypeError: No method matches given arguments for Initialization: (<class 'function'>, <class 'int'>)
I am bit confused and lost, can someone help me with this.