0

I have the following two files in a directory on Ubuntu:

program.exe
RFIDAPI.dll

program.exe was compiled on a Windows 7 machine using Visual C# Express as a "Console Application"

RFIDAPI.dll is a library that was given to me by the company who implemented the API for communicating with their device over ethernet.

When I run ./program.exe on the Ubuntu machine, mono-devel fails to find the dynamic library:

Unhandled Exception: System.DllNotFoundException: RFIDAPI.dll
    at(wrapper managed-to-native) Namespace.RFID_Class:Method_Call ()

The program runs fine on Windows with the same conditions. Any idea how I can get this program to link to the DLL on Ubuntu using mono-devel?

3
  • 2
    @AlexeiLevenkov The chances aren't low, they're non-existent. Linux can not run native code targeted at the Windows platform. The WINE application may enable certain native Windows code to run (with occasionally mixed results), Linux however cannot. Commented Jun 12, 2013 at 1:01
  • @Corey - removed comment as you have exactly the same (+1) answer. Commented Jun 12, 2013 at 1:04
  • @Corey, The program runs - mono just had trouble finding the DLL but since I found the document listed below it works now Commented Jun 12, 2013 at 1:26

2 Answers 2

1

A simple debugging helps point out the problem

export MONO_LOG_LEVEL=debug
./program.exe
...

This page has all the information I was looking for: http://www.mono-project.com/DllNotFoundException

Sign up to request clarification or add additional context in comments.

Comments

0

The only viable solution is to ask the company who supplied the DLL if they have a Linux library suitable for your particular distribution (Ubuntu version and Linux kernel version) that you can link against.

Each platform has different ways of handling native code libraries, and these libraries are not compatible between platforms. It is therefore not possible to link against a platform-specific library (a Windows DLL for instance) in a platform-neutral fashion.

MONO is a cross-platform re-implementation of the .NET runtime. It is intended to provide the ability to write .NET applications for non-Windows operating systems, and provides a reasonably consistent framework to enable you to easily port existing .NET applications. It is not a Windows emulator so it cannot use Windows-specific code, which includes any Windows-specific libraries.

2 Comments

Although your advice is well grounded, it is incorrect for this scenario. See my posted answer.
The missing piece of the puzzle, which basically invalidates my answer, is that the DLL in question is a .NET assembly rather than a native Windows DLL. That would have been helpful to know :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.