-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manually provide MiniDumpWriteDump and MINIDUMP_TYPE enum for now. #398
Comments
As per dotnet/ClangSharp#571 you need to explicitly handle each header, namely by adding the right files to handle |
Alright added it manually, just need to figure out a way to exclude all of the types that clangsharp generates for MiniDumpWriteDump except for the MINIDUMP_TYPE enum. I have already remapped those types in the function call to |
You shouldn’t exclude types like that. Typically whole headers are generated at once to avoid future breaks and potential issues |
Sadly in the case of this header the // Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/xmllite.h in the Windows SDK for Windows 10.0.26100.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.InteropServices;
namespace TerraFX.Interop.Windows;
/// <include file='MINIDUMP_CALLBACK_INFORMATION.xml' path='doc/member[@name="MINIDUMP_CALLBACK_INFORMATION"]/*' />
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public unsafe partial struct MINIDUMP_CALLBACK_INFORMATION
{
/// <include file='MINIDUMP_CALLBACK_INFORMATION.xml' path='doc/member[@name="MINIDUMP_CALLBACK_INFORMATION.CallbackRoutine"]/*' />
[NativeTypeName("MINIDUMP_CALLBACK_ROUTINE")]
public delegate* unmanaged<void*, MINIDUMP_CALLBACK_INPUT*, MINIDUMP_CALLBACK_OUTPUT*, BOOL> CallbackRoutine;
/// <include file='MINIDUMP_CALLBACK_INFORMATION.xml' path='doc/member[@name="MINIDUMP_CALLBACK_INFORMATION.CallbackParam"]/*' />
[NativeTypeName("PVOID")]
public void* CallbackParam;
} Ironically this can compile easily without anything except the Windows class containing the |
Ah I see, it's a warning that gets displayed as an error in Visual Studio. |
I guess time to try |
What is causing it to fail to compile?
|
Description (optional)
Currently ClangSharp skips generating these even though they are not explicitly excluded for some reason. As such until dotnet/ClangSharp#571 is fixed I think it is best to provide them manually for now.
Rationale
Currently for developers, one must manually provide the function signature to
MiniDumpWriteDump
even if they already depend on TerraFX.Interop.Windows, this function signature will often times be directly copied from the internet and might useSafeProcessHandle
,SafeFileHandle
, etc which means noWindows.OpenProcess
call forhProcess
, and noWindows.OpenFile
call forhFile
. This then results in bloating up their codebase more than it should be just from interop code that should be in TerraFX.Interop.Windows by default. It also makes things overly more complex than it needs to be especially for simple usage.Proposed API
The proposed API is as follows (enum values left out for impl PR):
Drawbacks
If a user wants to specify a non-null value for any of the last 3 params, they would need to manually create the types for them and then use them afterwards this would be because I would consider this advanced usage of the function and not basic usage with only passing
null
into them.Alternatives
No alternatives was considered.
Discussions (optional)
#241
#240
The text was updated successfully, but these errors were encountered: