6 ms·
Most of the documentation/tutorials you find will be perfectly relevant, but they may be Windows-centric based on .NET's history. At a really basic level, you
by mellinoe 10y ago
Most of the documentation/tutorials you find will be perfectly relevant, but they may be Windows-centric based on .NET's history.
At a really basic level, you simply declare a "static extern" method with a "DllImport" attribute attached to it. For example, you could call "printf" from libc like so:
[DllImport("libc")]
public static extern void printf(string message);
static void Main()
{
printf("Hello World");
}
- merb 10y agoWhat happens if the library isn't in LD_LIBRARY_PATH could I specify a path with DllImport?
- mellinoe 10y agoYes, you can specify a relative/absolute path in DllImport if you'd like. Generally it is easier to get consistent behavior if you either: 1) rely on the user to install the binary somewhere and place it on the path, or 2) deploy the native binary along with your application. We generally do 1) in .NET Core, or we rely on components of Windows, for example.
- merb 10y agoThat won't work with Nuance CSDK. It will install the Linux binary to /usr/local/nuance-csdk/bin, /usr/local/nuance-csdk/lib, etc..