-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
What feature or improvement do you think would benefit the app?
I need to create a library for unmanaged code abstraction, and CubeKit is the perfect place to put it. Bear in mind that this is a massive project and idea.
There should be a library created, either Riverside.Extensions.Fusion or just Riverside.Fusion which has source generators, helpers, and abstraction over interaction with unmanaged/native code imports.
Note
It would probably be best to just call it Riverside.Fusion as Riverside.Extensions.Fusion and Riverside.Extensions.PInvoke would have practically the same meaning.
Requirements
- Decide implementation
- Choose namespace
- Create logo
- Create spec for how it will be used (rough draft here)
- Implement via source generator
Version
No response
API Changes
There needs to be:
- A source generator
- Documentation (lots)
- Heavily abstracted
This needs to be using the absolute latest technologies and AOT-compatible - no fancy methods or reflection like DllImport uses, and a backend in LibraryImport and ComImport
Intended Use-Case
There are multiple ways this could be implemented, for example:
// Prebuilt source generator
// This is an extreme level of abstraction, and while
// it will make experience the easiest, it will be
// incredibly difficult to create.
using Riverside.Fusion;
using Riverside.Extensions.PInvoke;
namespace Example;
public class MyClass
{
/// <summary>
/// Method to check if elevation is required
/// </summary>
[UnmanagedImport(Shell32.IsElevationRequired)]
public bool IsElevationRequired(string pszPath)
{
return Shell32.IsElevationRequired(pszPath);
}
}UnmanagedImportAttribute is a single, unified attribute for all unmanaged code imports.
Its various constructors indicate which type of unmanaged code you are importing, whether that is from COM, ABI or Win32.
Fusion should also automatically convert unmanaged types into managed .NET types and vice versa, enabling you to represent LPWStr as just System.String, as shown in the example.
Important
I'm a beginner of COM, and I'm not very familiar with working with it.
You can also import functions from COM:
using Riverside.Fusion;
using Riverside.Extensions.PInvoke;
namespace Example;
// Argument1: Guid clsid, Argument2: IUnknown base, Argument3: string? hint
[UnmanagedImport(new Guid("8895b1c6-b41f-4c1c-a562-0d564250836f"), IUnknown, "IPreviewHandler")]
public class MyClass : IPreviewHandler
{
public void DoPreview()
{
// implementation
}
// other interface methods
}Comments
No response