[Mono-list] searching the right way - call dll or so
cdhowie at gmail.com
Wed Jun 3 10:37:10 EDT 2009
The correct way to do what the OP wants is to either use
DllImportAttribute with just the base name, like [DllImport("foo")]
will try to use foo.dll on windows and libfoo.so on Linux. If the
names do not follow that pattern then you must use a DllMap:
On Wed, Jun 3, 2009 at 10:34 AM, Stifu <stifu at free.fr> wrote:
> This may not be the best way to do this, but until someone suggests something
> better, something like this would work.
> First, have a method to detect the platform:
> public static bool IsWindows()
> if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
> Environment.OSVersion.Platform == PlatformID.Win32Windows)
> return true;
> return false;
> And then you could have a static variable to store the extension...
> DllExtension = IsWindows() ? "dll" : "so";
> And then simply do: "unmanagedFileName" + MyClass.DllExtension;
> real_bastie wrote:
>> I develop a small application for windows and linux. On both os I need to
>> call not managed code - dll under windows, so under linux.
>> How can I do the right call at application runtime?
> View this message in context: http://www.nabble.com/searching-the-right-way---call-dll-or-so-tp23830117p23852606.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> Mono-list maillist - Mono-list at lists.ximian.com
More information about the Mono-list