You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing a problem similar to this one. I would like to load a DLL from Nim passing parameters to it's constructor. The C# example is the following:
namespace TestSpace
{
public class Run
{
public Run(uint value1, IntPtr value2, int value3)
{
// Set Stuff
}
public void DoStuff()
{
// Do Stuff
}
}
}
I tried executing this constructor via e.g.
var assembly = load(dllbytes)
var Test = assembly.GetType("TestSpace.Run")
dump Test
# Works fine till there
with the following trials:
var
intvalue1: int = 1
intvalue2: int = 2
testHandle: HANDLE
Test.new(intvalue1,intvalue2,testHandle)
# leads to Error: unhandled exception: unable to invoke specified member: new (0x80131512) [CLRError]
Test.new(nil, aaa,testHandle,aaa)
# leads to unable to invoke specified member: CreateInstance (0x80131604) [CLRError]
var cmd: seq[string]
var i = 1
while i <= paramCount():
cmd.add(paramStr(i))
inc(i)
echo cmd
var arr = toCLRVariant(cmd, VT_BSTR)
Test.invoke(nil, toCLRVariant([arr]))
# Also Error: unhandled exception: unable to invoke specified member: CreateInstance (0x80131604) [CLRError]
# This is a string array from how I understood it, actually makes no sense as the function expects uint, Pointer and int. But it's not possible to embed (uint,HANDLE,int) in an array right?
I also tried executing the DoStuff function via e.g.
Test.invoke("DoStuff", BindingFlags_InvokeMethod or BindingFlags_Default)
# failed with Error: unhandled exception: unable to invoke specified member: DoStuff (0x80131512)
Test.DoStuff()
# same error
var arr = toCLRVariant([""], VT_BSTR) # Passing no arguments
echo @asd.DoStuff(nil, toCLRVariant([arr]))
# Error: unhandled exception: convert from VT_ARRAY(1D)|VT_VARIANT to integer [VariantConversionError]
# Why does it expect integer input?
Some idea how to pass the parameters for these examples?
Appreciate any help.
Greetings
The text was updated successfully, but these errors were encountered:
@S3cur3Th1sSh1t Did you ever figure this out? I'm having similar issues trying to create Assembly/AppDomain event handlers and basically getting the same errors.
Hey,
I'm facing a problem similar to this one. I would like to load a DLL from Nim passing parameters to it's constructor. The C# example is the following:
I tried executing this constructor via e.g.
with the following trials:
I also tried executing the
DoStuff
function via e.g.Some idea how to pass the parameters for these examples?
Appreciate any help.
Greetings
The text was updated successfully, but these errors were encountered: