/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
v2.0-alpha-1
src/OneScript.StandardLibrary/NativeApi/NativeApiKernel.cs
40 строк
2 KB
Andrey Ovsiankin
Влита ветка develop, доработаны классы NativeApi
08 дек 2020, 18:38
08 дек 2020, 18:38
1e5dda1
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System; using System.Runtime.InteropServices; namespace OneScript.StandardLibrary.NativeApi { /// <summary> /// Подключение DLL-файлов библиотеки внешних компонент Native API /// </summary> public class NativeApiKernel { private const string KernelDll = "kernel32.dll"; [DllImport(KernelDll, SetLastError = true, CharSet = CharSet.Unicode)] protected static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPWStr)] string lpLibFileName); [DllImport(KernelDll, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)] protected static extern IntPtr GetProcAddress(IntPtr module, string procName); [DllImport(KernelDll, SetLastError = true, CharSet = CharSet.Unicode)] protected static extern bool FreeLibrary(IntPtr module); private const string libdl = "libdl.so"; [DllImport(libdl)] protected static extern IntPtr dlopen(string filename, int flags); [DllImport(libdl)] protected static extern IntPtr dlsym(IntPtr handle, string symbol); [DllImport(libdl)] protected static extern IntPtr dlclose(IntPtr handle); } }