© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
33 replies
Glatrix ♄

❔ 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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

interface instead of mapping one by one
C#CC# / help
4y ago
Getting proccess by name
C#CC# / help
4y ago
Finding a button by name
C#CC# / help
2y ago
❔ Get full namespace name
C#CC# / help
3y ago