Glatrix
Glatrix
CC#
Created by Glatrix on 11/14/2022 in #help
❔ Importing functions by RVA instead of Name
right now, I have a function imported from a cpp library which I pass in a function name and params, and it gives me back a pointer to that function. And currently, I just cast it to a unmanaged function pointer and it works fine. Does anyone here know if there is a way to simplify this process by using a custom attribute? example: instead of
delegate* unmanaged[Cdecl]<int,int,void> DoThing = (delegate* unmanaged[Cdecl]<int,int,void>)ResolveFunc("DoThing(int, int)");
delegate* unmanaged[Cdecl]<int,int,void> DoThing = (delegate* unmanaged[Cdecl]<int,int,void>)ResolveFunc("DoThing(int, int)");
just
[Resolvable("DoThing(int, int)")]
public static extern void DoThing(int pA, int pB);
[Resolvable("DoThing(int, int)")]
public static extern void DoThing(int pA, int pB);
or similar. How can I go about making ResolvableAttribute?
34 replies