E
The reference to the downloading of the omnibus example I left a very low answer to the question.LinuxIt's just, there's a 64-battered gcc default system that will compil 64 battle binaries. Accordingly, the task is to write a simple cherry function, a code downstream#include <stdio.h>
#include <libnotify/notify.h>
int notify(const char *title, const char description,int timeout)
{
notify_init("dcnn");
NotifyNotification n = notify_notification_new (title, description, 0);
notify_notification_set_timeout(n, timeout);
if (!notify_notification_show(n, 0))
{
printf("Notification fallen");
return -1;
}
printf("Notificated");
//notify_uninit (void);
return 1;
}
Nothing complicated. Don't look at the contents, it's just a function that can get the meaning back. Compiled through gcc with the following parameters: gcc -Wall -shared -o native.so -fPIC native.c pkg-config --cflags --libs gtk+-2.0 libnotify -lnotify
It's important to compile one team. Yeah, there's a way to get objective modules first.o, but the compiler will forget to add... I also recommend that, without departing from the cash register to try to make a dynamic import of the library from another cherry programme, the ubuntu folder has a test file.c with its implementation. But if you can write right, you can miss it. After collecting the file, native.so♪ He needs to be put in a folder with a collection for Net Core. When I was default, I had a collection at the directory. DotnetCoreNativeNotifications/bin/Debug/netcoreapp2.0/
It's a simple matter. Everything in MS records.public class UbuntuNotify : AbstractNotify
{
public UbuntuNotify(){}
[DllImport("native.so")]
private static extern int notify([MarshalAs(UnmanagedType.LPStr)]string title,[MarshalAs(UnmanagedType.LPStr)]string description, int timeout);
public override void Notify(string title, string desc, int timeout)
{
UbuntuNotify.notify(title,desc,timeout);
}
}
In Program.cs, I'm checking if-- a platform, creating a copy of this class and calling Notify. WindowsFirst, select the right software for application. I don't recommend trying to write dll in Visual Studio. In my view, it is buried under C# and the process of writing a dynamically connected library in it will last a long time, because There's no dll project template.Take the Code: http://www.codeblocks.org/ We''ll put it on. 64 Battle Compiler♪ It's important, without it.Article of how to put it here, https://medium.com/@yzhong.cs/code-blocks-compile-64-bit-under-windows-with-mingw-w64-79101f5bbc02 Create dll, C++
Don't forget to pick a RULE compiler.
Next, he's generating a fairly readable code. Look at the dll code that puts notices on Windows. https://github.com/tripolskypetr/DotnetCoreNativeNotifications/blob/master/windows/native/main.cpp After we've finished the dll, we've also put it in the folder of the Net Core, I've doing the next class for treatment.public class WindowsNotify : AbstractNotify
{
public WindowsNotify(){}
[DllImport("native.dll", CallingConvention = CallingConvention.Cdecl)]
private extern static void NotifyFunc([MarshalAs(UnmanagedType.LPStr)]string title, [MarshalAs(UnmanagedType.LPStr)]string desc);
public override void Notify(string title, string desc, int timeout)
{
WindowsNotify.NotifyFunc(title,desc);
}
}
In the end, we got a project called Net Core, which also gave us notice to Ubuntu and Windows 10. Wonderful.
WARN: In different versions, dozens may not work because WinAPI is being used and it changes too... My computer works for version 1703, it's old enough. I recommend that we try the same example, but in dll on Windows, we call MessageBoxA as in the Code ' s dll environment: "Blocks, I hope it's not small to reach it. I'm calm about linux. ♪void DLL_EXPORT SomeFunction(const LPCSTR sometext)
{
MessageBoxA(0, sometext, "DLL Message", MB_OK | MB_ICONINFORMATION);
}
See the full code of this example here, https://github.com/tripolskypetr/DotnetCoreNativeNotifications