Another way to invoke the EntryPoint of .NET assembly.
khchen opened this issue · 3 comments
khchen commented
https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodbase.invoke?view=net-5.0
Hint: parameters of EntryPoint.Invoke is (Object, Object[])
.
Object[]
can be created by toCLRVariant(openArray)
, so...
# omit other part of execute_assembly_bin.nim...
var assembly = load(buf)
var arr = toCLRVariant(["From Nim & .NET!"], VT_BSTR)
echo assembly.EntryPoint.Invoke(nil, toCLRVariant([arr]))
byt3bl33d3r commented
sweet! Thank you!
byt3bl33d3r commented
Fixed! Thanks!
naliferopoulos commented
Sorry for reviving this old and closed issue but I have been trying to extend the functionality of the execute-assembly module to allow it to grab the stdout output of the Assembly after execution from the stdout buffer. I have tried reopen() to remap stdout to a file and seeking back to its start to read it, as well as seeking directly on the stdout pipe but without much success. Does anybody know how to implement this correctly? Thanks :)