Update wpiutil and ntcore native imports and native-backed structs#132
Update wpiutil and ntcore native imports and native-backed structs#132ThadHouse wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71e03077e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public static partial class SynchronizationNative | ||
| { | ||
| [LibraryImport("wpiutil", EntryPoint = "WPI_CreateEvent")] | ||
| [LibraryImport("wpiutil", EntryPoint = "WPI_MakeEvent")] |
There was a problem hiding this comment.
Use exported WPI_CreateEvent entry point
When code calls SynchronizationNative.CreateEvent, this import now asks the loader for WPI_MakeEvent, but the wpiutil C API still exports the C entry point as WPI_CreateEvent (the MakeEvent name is only the C++ wrapper name). This will throw EntryPointNotFoundException at runtime for any path that creates an event, so the entry point should remain WPI_CreateEvent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
You're using out of date information here. The entry point has changed in wpilib.
| public static partial void ResetEvent(WpiEventHandle handle); | ||
|
|
||
| [LibraryImport("wpiutil", EntryPoint = "WPI_CreateSemaphore")] | ||
| [LibraryImport("wpiutil", EntryPoint = "WPI_MakeSemaphore")] |
There was a problem hiding this comment.
Use exported WPI_CreateSemaphore entry point
When code calls SynchronizationNative.CreateSemaphore, this import now looks for WPI_MakeSemaphore, but the native C ABI exports WPI_CreateSemaphore (the MakeSemaphore spelling is the C++ wrapper). Any semaphore creation will fail at runtime with EntryPointNotFoundException, so keep this P/Invoke bound to WPI_CreateSemaphore.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Again, you're using out of date information here.
Motivation
wpiutilandntcorewith the current upstream C API to restore correctness and interoperability.Description
wpiutilnative imports: replaced event/semaphore entry points withWPI_MakeEvent/WPI_MakeSemaphore, addedWPI_CreateSignalObject, corrected return marshalling to signedint, and added string init/allocate APIs (WPI_InitString,WPI_InitStringWithLength,WPI_AllocateString,WPI_AllocateStringArray) inStringsNative.NativeRawFrame, addingWPI_SetRawFrameData, propagatingTimestampandTimestampSourcethroughRawFrameReader/RawFrameWriter, and addingBgra+TimestampSourceenum inPixelFormat.ntcorenative imports and helpers: addedNT_WaitForListenerQueue,NT_AddPolledListenerSingle, fixedNT_StopConnectionDataLogentry point, and added native array allocation/free APIs (NT_AllocateBooleanArray,NT_AllocateIntegerArray,NT_AllocateFloatArray,NT_AllocateDoubleArrayand corresponding free functions) inNtCore.Free.PubSubOptionsto usepollStorageand anNtPublisherhandle forExcludePublisher(with aPollSizecompatibility accessor), adjustedNetworkModeflags to includeClientandMdnsAnnouncing, and correctedLogMessagemarshalling to use thefilenamefield.Testing
dotnet build src/ntcore/ntcore.csprojwhich succeeded after a restore. (succeeded)dotnet build src/cscore/cscore.csprojwhich succeeded after restore. (succeeded)dotnet build src/ntcore/ntcore.csproj --no-restorewhich failed due to missing NuGet assets (expected without restore), then restored and rebuilt successfully. (initial failure due to restore; final build succeeded)git diff --checkto ensure no spacing/whitespace issues. (succeeded)Codex Task