libplctag.NativeImport
1.0.40
See the version list below for details.
dotnet add package libplctag.NativeImport --version 1.0.40
NuGet\Install-Package libplctag.NativeImport -Version 1.0.40
<PackageReference Include="libplctag.NativeImport" Version="1.0.40" />
paket add libplctag.NativeImport --version 1.0.40
#r "nuget: libplctag.NativeImport, 1.0.40"
// Install libplctag.NativeImport as a Cake Addin #addin nuget:?package=libplctag.NativeImport&version=1.0.40 // Install libplctag.NativeImport as a Cake Tool #tool nuget:?package=libplctag.NativeImport&version=1.0.40
libplctag.NativeImport
libplctag.NativeImport provides low-level (raw) access to the libplctag core library which is written in C. The purpose of this package is to expose the API for this library to .NET applications, and handle platform and configuration issues.
NOTE: Most application developers will not need to directly reference the Native Import library, it is primarily for use by other wrapper libraries.
Example
var tagHandle = plctag.plc_tag_create("protocol=ab_eip&gateway=10.10.10.10&path=1,0&plc=LGX&elem_size=4&elem_count=1&name=PROGRAM:SomeProgram.SomeDINT", 5000);
var statusAfterCreate = (STATUS_CODES)plctag.plc_tag_status(tagHandle);
if (statusAfterCreate != STATUS_CODES.PLCTAG_STATUS_OK)
{
throw new Exception($"Something went wrong: {statusAfterCreate}");
}
var statusAfterRead = (STATUS_CODES)plctag.plc_tag_read(tagHandle, 5000);
if (statusAfterRead != STATUS_CODES.PLCTAG_STATUS_OK)
{
throw new Exception($"Something went wrong: {statusAfterRead}");
}
var theValue = plctag.plc_tag_get_uint32(tagHandle, 0);
Console.WriteLine(theValue);
plctag.plc_tag_destroy(tagHandle);
Further examples of its usage can be found here.
How it works
During initialization, this package extracts to disk the appropriate (platform-specific) core library.
By default, it will overwrite files with the same filename (plctag.dll
, libplctag.so
, or libplctag.dylib
).
If you wish to disable this behaviour and use a different core library (e.g. one that you've compiled yourself, or a pre-release), you can disable the Force Extract feature.
// Before any calls to any libplctag methods
plctag.ForceExtractLibrary = false;
The libplctag core library can be compiled for many platforms, and not all supported platforms are shipped with this wrapper.
If you get a TypeLoadException
, chances are that you can still use this wrapper but you will need to supply the runtime yourself.
Developing for systems with immutable application directories
UWP, Xamarin.Forms and some other frameworks produce executables that, when installed, can not modify their own application directory. libplctag.NativeImport relies on the ability to extract the native library to this location, so on these platforms, libplctag will not work.
The workaround is to supply the appropriate binary(ies) yourself:
- Get the core library (e.g. plctag.dll) from Releases.
- Add this file to your project such that it is copied to the output directory.
- Set
plctag.ForceExtractLibrary = false
before any other calls to libplctag.
Watch out for x64/x86 mismatches between the native library you downloaded and your solution.
This bug is tracked in https://github.com/libplctag/libplctag.NET/issues/137
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Net.Primitives (>= 4.3.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on libplctag.NativeImport:
Package | Downloads |
---|---|
libplctag
A library for PLC communication |
|
ABPlcRx
A Reactive Allen Bradley PLC library |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on libplctag.NativeImport:
Repository | Stars |
---|---|
libplctag/libplctag.NET
A .NET wrapper for libplctag.
|
Version | Downloads | Last updated |
---|---|---|
2.0.0-alpha.4 | 95 | 9/7/2024 |
2.0.0-alpha.3 | 90 | 8/22/2024 |
2.0.0-alpha.2 | 808 | 7/26/2024 |
2.0.0-alpha.1 | 61 | 7/17/2024 |
2.0.0-alpha.0 | 51 | 7/17/2024 |
1.0.41 | 6,599 | 7/13/2024 |
1.0.40 | 527 | 7/12/2024 |
1.0.39 | 1,971 | 6/15/2024 |
1.0.38 | 144 | 6/8/2024 |
1.0.37 | 73,753 | 12/1/2022 |
1.0.36 | 469 | 11/19/2022 |
1.0.35 | 515 | 11/4/2022 |
1.0.34 | 7,131 | 9/28/2022 |
1.0.33 | 11,490 | 7/5/2022 |
1.0.32 | 7,769 | 2/14/2022 |
1.0.31 | 1,024 | 1/27/2022 |
1.0.30 | 505 | 1/10/2022 |
1.0.29 | 437 | 12/31/2021 |
1.0.28 | 410 | 12/27/2021 |
1.0.25 | 2,035 | 12/16/2021 |
1.0.24 | 2,926 | 11/25/2021 |
1.0.23 | 401 | 11/14/2021 |
1.0.22 | 921 | 11/5/2021 |
1.0.21 | 476 | 10/28/2021 |
1.0.20 | 397 | 10/24/2021 |
1.0.19 | 3,083 | 10/15/2021 |
1.0.18 | 471 | 10/15/2021 |
1.0.17 | 12,547 | 9/24/2021 |
1.0.16 | 673 | 9/22/2021 |
1.0.15 | 712 | 9/18/2021 |
1.0.14 | 844 | 8/30/2021 |
1.0.13 | 3,277 | 3/20/2021 |
1.0.12 | 5,520 | 3/13/2021 |
1.0.11 | 460 | 3/13/2021 |
1.0.10 | 2,489 | 3/7/2021 |
1.0.9 | 743 | 2/24/2021 |
1.0.8 | 393 | 2/21/2021 |
1.0.8-beta.1 | 164 | 2/21/2021 |
1.0.7 | 446 | 2/16/2021 |
1.0.7-beta.0 | 163 | 2/16/2021 |
1.0.6 | 423 | 2/14/2021 |
1.0.5 | 393 | 2/13/2021 |
1.0.4 | 422 | 2/9/2021 |
1.0.3 | 398 | 2/4/2021 |
1.0.2 | 8,105 | 1/11/2021 |
1.0.1 | 1,818 | 10/28/2020 |
1.0.0 | 985 | 9/16/2020 |
0.0.14 | 765 | 9/9/2020 |
0.0.13 | 518 | 9/9/2020 |
0.0.12 | 491 | 9/1/2020 |
0.0.11-beta | 2,261 | 8/4/2020 |
0.0.11-alpha | 504 | 7/29/2020 |
0.0.10-alpha | 437 | 7/27/2020 |
0.0.9-alpha | 463 | 7/25/2020 |
0.0.8-alpha | 491 | 7/21/2020 |
0.0.7-alpha | 523 | 7/18/2020 |
0.0.6-alpha | 416 | 7/14/2020 |
0.0.5-alpha | 489 | 7/11/2020 |
0.0.4-alpha | 391 | 7/11/2020 |