Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Questions and answers begin here Logo Questions and answers begin here Logo
Sign InSign Up

Questions and answers begin here

Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us

Linux Mono invoke my SO lib return System.EntryPointNotFoundException (solved)

Home/ Questions/Q 398
Next
In Process
Linux Mono invoke my SO lib return System.EntryPointNotFoundException (solved)
bigd88091
bigd88091 Begginer

I’m facing an issue while trying to run a native C++ library through a managed C# application in Linux using Mono. Initially, I had a problem where Mono was not able to locate my .so file, but I resolved it by setting an LD_LIBRARY_PATH environment variable. However, now I’m facing a new problem where Mono is throwing a System.EntryPointNotFoundException when trying to invoke one of the functions in my library.
Here is the relevant code snippet in C#:

[DllImport("mylib.so")]
public static extern void my_func(int arg1);
...
try
{
my_func(123);
}
catch (EntryPointNotFoundException e)
{
Console.WriteLine("Failed to find the entry point: {0}", e.Message);
}

I have verified that my_func is indeed present in the library by running nm -D mylib.so. This is very confusing to me as the function clearly exists, and it is being successfully imported by Mono. I have tried running ldd on mylib.so, and I see that there are no missing dependencies. Can anyone guide me on how to troubleshoot this error?

c#dynamic-linkinglinuxmonosystem.entrypointnotfoundexception
  • 820
  • 0 Followers
  • 1
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    flredneck86 Begginer
    2017-07-14T11:37:23+00:00Added an answer about 6 years ago

    Hello there!
    From what I understand, you are encountering an issue with a System.EntryPointNotFoundException when trying to use Mono to invoke your .so lib in Linux. This error is usually caused by a mismatch between the function signature in the P/Invoke declaration and the actual function signature in the native library.
    One possible solution is to use the nm command to check the actual signature of the function in your .so file. This will allow you to update your P/Invoke declaration accordingly. For example, if you have a function named “myfunction” in your .so file, you can run the following command to get the signature:
    “`
    nm -D libMyLibrary.so | grep myfunction
    “`
    This will output the actual signature of the function, which you can then use to update your P/Invoke declaration.
    Another possible solution is to make sure that the function is being exported correctly from the .so file. You can do this using the following command:
    “`
    objdump -T libMyLibrary.so | grep myfunction
    “`

    This will output the symbols that are being exported by the .so file. Make sure that your function is included in the list of exported symbols.

    It’s also worth noting that the EntryPointNotFoundException can sometimes be caused by a missing library dependency. Make sure that all the required libraries are installed and available on your system.

    I hope this helps you resolve the issue you are facing. Let me know if you have any other questions or if there’s anything else I can do to help. Good luck!

    • 129
    • Reply
    • Share
      Share
      • Share onFacebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. evil_panda28
    2017-07-29T21:58:53+00:00Added an answer about 6 years ago

    There are several potential causes for a `System.EntryPointNotFoundException` when using `mono_invoke()` in Linux. One possibility is that the library’s function entry point has been changed or renamed. Another possibility is that the library is not being loaded properly due to errors in the library path. It’s also possible that the library has not been properly compiled or linked.

    To diagnose and resolve the problem, make sure that you are using the correct library and that it is properly installed and configured. Check the library path to ensure that it is being loaded properly. You can also try rebuilding the library and recompiling your code to make sure that there are no issues with the build process.

    In addition, it’s important to make sure that you are using the correct version of `mono` for your system, as different versions may have different requirements and compatibility issues. Finally, be sure to check any relevant documentation or community resources for additional tips and troubleshooting steps.

    • 47
    • Reply
    • Share
      Share
      • Share onFacebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.