Open ltemimi opened 5 years ago
Hi, ok change the CpuType. For cpu see https://github.com/kyle-github/libplctag/wiki/Tag-String-Attributes
Best Regards
Hi Frank I still have the issue I tried the csharp-wrapper and it works
internal Tag(Controller controller, string name, int size, int length = 1)
{
Controller = controller;
Name = name;
Size = size;
Length = length;
ValueManager = new TagValueManager(this);
TypeValue = typeof(TType);
var url = $"protocol=ab_eip&gateway={controller.IPAddress}";
if (!string.IsNullOrEmpty(controller.Path)) { url += $"&path={controller.Path}"; }
url += $"&cpu={controller.CPUType}&elem_size={Size}&elem_count={Length}&name={Name}";
if (controller.DebugLevel > 0) { url += $"&debug={controller.DebugLevel}"; }
//create reference
**Handle = NativeLibrary.plc_tag_create(url, controller.Timeout);**
Value = TagHelper.CreateObject<TType>(Length);
}
in line //create reference Handle = NativeLibrary.plc_tag_create(url, controller.Timeout);
I get an exception System.BadImageFormatException. 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT 0x8007000B')
please help Laz
Hi Frank I still have the issue I tried the csharp-wrapper and it works
internal Tag(Controller controller, string name, int size, int length = 1) { Controller = controller; Name = name; Size = size; Length = length; ValueManager = new TagValueManager(this); TypeValue = typeof(TType); var url = $"protocol=ab_eip&gateway={controller.IPAddress}"; if (!string.IsNullOrEmpty(controller.Path)) { url += $"&path={controller.Path}"; } url += $"&cpu={controller.CPUType}&elem_size={Size}&elem_count={Length}&name={Name}"; if (controller.DebugLevel > 0) { url += $"&debug={controller.DebugLevel}"; } //create reference **Handle = NativeLibrary.plc_tag_create(url, controller.Timeout);** Value = TagHelper.CreateObject<TType>(Length); }
in line //create reference Handle = NativeLibrary.plc_tag_create(url, controller.Timeout);
I get an exception System.BadImageFormatException. 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT 0x8007000B')
please help Laz
Hi Laz,
Were you able to find a solution for this issue? I am experiencing the similar problem. I have tried other referenced wrappers and it works fine with ASP.NET Framework. I tried using this wrapper(ASP.NET Standard) on a new ASP.NET core application but with no luck.
BR, Naddy
Update: In order to fix the issue I had to use Dependency Walker to identify the missing dll that this wrapper/plctag.dll had dependency on. To fix the VC++ .dll file dependency I modified the Visual Studio to add Desktop Development using C++ (any other module that uses C++ can be added though).
Hi I tried your software with Soft Logix 19 and I get format error and could not read the tags Does it work with soft logix? if yes any idea why I a unable to read tags?
Thanks Laz