Skip to content

nethost Hosting Sample- Invoking simple method via load_assembly_and_get_function_pointer #31796

@comeradealexi

Description

@comeradealexi

Apologies if this is the incorrect place for this question but I think I'm missing something in how load_assembly_and_get_function_pointer from the hosting example works.

In the hosting example it uses load_assembly_and_get_function_pointer to get a pointer to the C# method: public static int Hello(IntPtr arg, int argLength) which works fine.

In my tests though, I want to just invoke a more simple method: public static void HelloSimple() but I'm unable to get this to work, load_assembly_and_get_function_pointer will return error code (-2147024809 / 0x80070057) - I'm not 100% sure what these error codes relate to. I couldn't find them on https://github.com/dotnet/runtime/blob/main/docs/design/features/host-error-codes.md

I can easily get my methods to invoke if I ensure a parameter is passed and a value is returned. Is this some kind of requirement when invoking C# or perhaps I'm missing some additional code required to allow me to invoke more simple methods?


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 98747

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions