You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[DllImport("BS_SDK_V2.dll", CallingConvention = CallingConvention.Cdecl)]
extern public static int BS2_SetIPConfig(IntPtr context, UInt32 deviceId, ref BS2IpConfig config);
のBS2_SetIPConfigの第3引数でコンパイルエラーが起きて回避できません。
理由を御社のTicketSiteで質問しましたが、一方的にTicket Closeされました。
BS2IpConfig bs2IpConfig = new BS2IpConfig();
bs2IpConfig.ipAddress = Encoding.ASCII.GetBytes("192.168.0.123");
result = (BS2ErrorCode)API.BS2_SetIPConfig(context, deviceID, ref bs2IpConfig);
のようにやっても、エラーになります。
Unhandled exception. System.ArgumentException: Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout.
at System.StubHelpers.MngdFixedArrayMarshaler.ConvertSpaceToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome)
--- End of stack trace from previous location ---
at Suprema.API.BS2_SetIPConfig(IntPtr context, UInt32 deviceId, BS2IpConfig& config)
at Biostar2SDKTest.Program.Main(String[] args)
Suprema 担当者様へ
いつもお世話になっております。
SFApi.csファイルに含まれる
[DllImport("BS_SDK_V2.dll", CallingConvention = CallingConvention.Cdecl)]
extern public static int BS2_SetIPConfig(IntPtr context, UInt32 deviceId, ref BS2IpConfig config);
のBS2_SetIPConfigの第3引数でコンパイルエラーが起きて回避できません。
理由を御社のTicketSiteで質問しましたが、一方的にTicket Closeされました。
BS2IpConfig bs2IpConfig = new BS2IpConfig();
bs2IpConfig.ipAddress = Encoding.ASCII.GetBytes("192.168.0.123");
result = (BS2ErrorCode)API.BS2_SetIPConfig(context, deviceID, ref bs2IpConfig);
のようにやっても、エラーになります。
Unhandled exception. System.ArgumentException: Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout.
at System.StubHelpers.MngdFixedArrayMarshaler.ConvertSpaceToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome)
--- End of stack trace from previous location ---
at Suprema.API.BS2_SetIPConfig(IntPtr context, UInt32 deviceId, BS2IpConfig& config)
at Biostar2SDKTest.Program.Main(String[] args)
Ticketで質問したら、C++構造体だと言われて
IntPtr pStructure = Marshal.AllocCoTaskMem(Marshal.SizeOf(bs2IpConfig));
Marshal.StructureToPtr(bs2IpConfig, pStructure, false);
Marshal.FreeCoTaskMem(pStructure);
のように、追加してみても、結局エラーになります。
改善策を提示してください。
宜しくお願いします。
ConfigControl.csのSetIPConfigを使う方法は動作するのに、BS2_SetIPConfigは何故動作しませんか?
教えてください。
The text was updated successfully, but these errors were encountered: