Hi Jim (and sorry to bother), but I found the following link you participated in and I had a question related to this for C# you might be able to help.
https://stackoverflow.com/questions/62331489/c-sharp-calling-a-dll-function-that-returns-a-pointer-to-pointer-to-an-array-of
First, let me thank you for providing current tidbits to help the community on related topic. Very helpful so far.
I'm creating a C# wrapper class for the STM32CubProg and was successful using similar code to get a list of connected ST-LINKs. The major hurdle now is setting up basic code to pass the selected DebugConnectParameters to connect with the device. When calling the connect function, it always returns -8 (Invalid Parameters). Below is some basic code I've setup...
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Ansi)]publicclassDebugConnectParameters{publicDebugPortDebugPort;publicintIndex;[MarshalAs(UnmanagedType.ByValTStr,SizeConst=33)]publicstringSerialNumber;[MarshalAs(UnmanagedType.ByValTStr,SizeConst=20)]publicstringFirmwareVersion;[MarshalAs(UnmanagedType.ByValTStr,SizeConst=5)]publicstringTargetVoltage;publicintAccesPortNumber;publicintAccessPort;publicDebugConnectModeConnectionMode;publicDebugResetModeResetMode;publicintIsOldFirmware;publicFrequenciesFrequencies;publicintFrequency;publicintIsBridge;publicintShared;[MarshalAs(UnmanagedType.ByValTStr,SizeConst=100)]publicstringBoard;publicintDebugSleep;publicintSpeed;}Stm32CubeProgrammer.Commands.StLink.GetList(false,outStm32CubeProgrammer.Types.DebugConnectParameters[]stLinkList);intresult=Stm32CubeProgrammer.Commands.StLink.Connect(stLinkList[0]);publicstaticintConnect(DebugConnectParametersdebugParameters){IntPtrstListPtr=Marshal.AllocHGlobal(Marshal.SizeOf<DebugConnectParameters>());Marshal.StructureToPtr(debugParameters,stListPtr,true);returnNativeCommands.ConnectStLink(stListPtr);}[DllImport(Native.CubeProgrammerApiDllFilePath,CallingConvention=CallingConvention.Cdecl,EntryPoint="connectStLink")]publicstaticexternintConnectStLink(IntPtrdebugParameters);Were you successful in passing in the DebugConnectParameters data structure to make a successful connection?
Again, sorry for intruding (especially since this is a Python API). Any help will be appreciated.
Hi Jim (and sorry to bother), but I found the following link you participated in and I had a question related to this for C# you might be able to help.
https://stackoverflow.com/questions/62331489/c-sharp-calling-a-dll-function-that-returns-a-pointer-to-pointer-to-an-array-of
First, let me thank you for providing current tidbits to help the community on related topic. Very helpful so far.
I'm creating a C# wrapper class for the STM32CubProg and was successful using similar code to get a list of connected ST-LINKs. The major hurdle now is setting up basic code to pass the selected
DebugConnectParametersto connect with the device. When calling the connect function, it always returns -8 (Invalid Parameters). Below is some basic code I've setup...Were you successful in passing in the
DebugConnectParametersdata structure to make a successful connection?Again, sorry for intruding (especially since this is a Python API). Any help will be appreciated.