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

[macos/arm64] Invalid int mapping for gssize, e.g. inside g_filename_from_utf8 signature #345

Closed
spouliot opened this issue Apr 22, 2022 · 1 comment · Fixed by #346
Closed

Comments

@spouliot
Copy link
Contributor

The 2nd argument of g_filename_from_utf8 [1] is a gssize [2] which should be 64 bits on 64 bits architectures. Due to ABI this does not seems to have caused problems before now (on x86_64) but this does not work correctly on arm64.

References

[1] https://developer-old.gnome.org/glib/stable/glib-Character-Set-Conversion.html#g-filename-from-utf8
[2] https://developer-old.gnome.org/glib/stable/glib-Basic-Types.html#gssize

Test

	[Test]
	public void StringToFilenamePtr ()
	{
		var p = Marshaller.StringToFilenamePtr ("benchmark-results");
		Assert.That (p, Is.Not.EqualTo (IntPtr.Zero), "not null");
		Marshaller.Free (p);
	}

Results

  Failed StringToFilenamePtr [103 ms]
  Error Message:
   GLib.GException : Invalid byte sequence in conversion input
  Stack Trace:
     at GLib.Marshaller.StringToFilenamePtr(String str) in /Users/poupou/git/external/GtkSharp/Source/Libs/GLibSharp/Marshaller.cs:line 134
   at Tests.Tests.StringToFilenamePtr() in /Users/poupou/git/external/GtkSharp/Tests/GLib/Marshaller.cs:line 19

Failed!  - Failed:     1, Passed:     1, Skipped:     0, Total:     2, Duration: 110 ms - /Users/poupou/git/external/GtkSharp/Tests/bin/Debug/net6.0/Tests.dll (net6.0)
spouliot added a commit to spouliot/GtkSharp that referenced this issue Apr 22, 2022
@spouliot spouliot changed the title [macos/arm64] Invalid signature for g_filename_from_utf8 [macos/arm64] Invalid int mapping for gssize, e.g. inside g_filename_from_utf8 signature Apr 23, 2022
@spouliot
Copy link
Contributor Author

The signature for g_filename_to_utf8 suffers from the same mistake and does not work, as is, on macos/arm64. There might be more of them (more than 300 delegates uses int parameters).

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

Successfully merging a pull request may close this issue.

1 participant