NoWrap questions
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reproducing the two NoWrap examples in the issue: the opaque-pointer typedef and the function-pointer typedef, then inspect the corresponding code-generation path. Separately trace how generated function, type, and constant names are chosen. Done means the intended NoWrap behavior and prefix-removal options are agreed and covered by focused generation tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
First off thanks for this incredible library it's mostly easy to use and works well. I do have some questions though regarding the NoWrap option.
- When using nowrap for an opaque ptr typedef it still wraps for example:
typedef struct Test Test;
Will result in
[global::System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public readonly partial struct Test : IEquatable<native.Test >
{
public Test(nint handle) => Handle = handle;
public nint Handle { get; }
public bool Equals(Test other) => Handle.Equals(other.Handle);
public override bool Equals(object obj) => obj is Test other && Equals(other);
public override int GetHashCode() => Handle.GetHashCode();
public override string ToString() => "0x" + (nint.Size == 8 ? Handle.ToString("X16") : Handle.ToString("X8"));
public static bool operator ==(Test left, Test right) => left.Equals(right);
public static bool operator !=(Testleft, Testright) => !left.Equals(right);
}
Is it possible to just ignore the typedef if it is an opaque ptr and just use nint whenever it is used as a parameter or member?
- When using nowrap for an function pointer typedef. it does not generate a type at all, for example:
typedef void (*Testfun)(int arg1, const char* arg2);
gets ignored and functions using it as param get the following signature
public static partial delegate*unmanaged[Cdecl]<int, byte*, void> setTestCallback(delegate*unmanaged[Cdecl]<int, byte*, void> callback);
Would it be possible to just not wrap it and add the delegate to the main class directly like so:
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void Testfun(int arg1, const char* arg2);
And lastly maybe a bit unrelated question but what would be the easiest way to change the names of functions, types and constants?Within a c library they often prefix a library name as a sort of namespace, In c# this would be unnecessary as you already have both the namespace and the class. Is there a built-in way to remove such a suffix? for example testInit() to just Init() where test is the prefix?
- Ngôn ngữ chính
- C#
- Star
- 142
- Fork
- 16
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của xoofx/CppAst.CodeGen
-
Custom type mappingĐang mởquestion
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
xoofx/CppAst.CodeGen#35 · 1 bình luận ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
xoofx/CppAst.CodeGen#34 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
xoofx/CppAst.CodeGen#32 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
xoofx/CppAst.CodeGen#29 ·
Tất cả issue của xoofx/CppAst.CodeGen
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted ready-for-human
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Attention: a throwing permission check on one contributor fails the whole aggregation requestĐang mởready-for-agent size:S status:todo
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
elsa-workflows/elsa-foundation#2830 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Review - Maintainer WG-Maintainers-Build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
PowerShell/PowerShell#28220 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: docs eco: dotnet good first issue help wanted lane: free-agent roadmap size: XS type: docs
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 72/100
arminazimi/evergreen#377 ·
Maintainer thường phản hồi trong vòng 1 ngày