I'm currently working on an Avalonia UI project where I need to call a function from a custom DLL using the DllImport attribute. However, I'm encountering an issue where I'm getting the error message:
System.EntryPointNotFoundException: 'Unable to find an entry point named 'GiveMeNumber' in DLL 'LibraryAdd'.'
Here's the relevant code snippet from my Avalonia UI project:
[DllImport(@"LibraryAdd", EntryPoint = "GiveMeNumber", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern int GiveMeNumber();
private void PointerPressed(object sender, PointerPressedEventArgs e)
{
GiveMeNumber();
}
I've verified that the DLL "LibraryAdd.dll" exists in the same directory as my executable. The function GiveMeNumber
is supposed to be exported from the DLL, but it seems that my code is unable to find the entry point.
What could be causing this issue? How can I resolve it and successfully call the GiveMeNumber
function from my Avalonia UI application?
I would greatly appreciate any insights or solutions to this problem. Thank you in advance for your help!