Skip to content
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

Allow setting up custom data with udata_setAppData #177

Open
dzendras opened this issue Nov 8, 2022 · 0 comments
Open

Allow setting up custom data with udata_setAppData #177

dzendras opened this issue Nov 8, 2022 · 0 comments

Comments

@dzendras
Copy link

dzendras commented Nov 8, 2022

Is your feature request related to a problem? Please describe.

I want to replace my existing codebase using some earlier icu.net code with the latest nuget package. I need to load a custom *.dat file to memory for a normalizer to use. The existing code is:

 var data = new byte[] { /* utr30.dat */ };
 var unmanagedPointer = Marshal.AllocHGlobal(data.Length);
 Marshal.Copy(data, 0, unmanagedPointer, data.Length);

 ErrorCode status2;
 NativeMethods.udata_setAppData("utr30", unmanagedPointer, out status2);
 ExceptionFromErrorCode.ThrowIfError(status2);

Describe the solution you'd like

Create a .NET wrapper that would allow setting custom data.

Describe alternatives you've considered

Copy ThrowIfError from this repo and reproduce NativeMethods.udata_setAppData in my project in order for it to work. Ugly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants