Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Add libint support #3300

Closed
wants to merge 1 commit into from
Closed

Add libint support #3300

wants to merge 1 commit into from

Conversation

adelavais
Copy link

Hello! I was working on adding internationalization to a program and I observed that locale.h exists in core.stdc, but libintl.h doesn't. I think introducing this header would help D, as functions from locale.h and libintl.h are often used together, and it would bring internationalization into D.
I am aware that this PR is technically a WIP, but I need help in continuing and feedback if this is something worth pursuing in D.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @adelavais! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3300"

@pbackus
Copy link
Contributor

pbackus commented Dec 2, 2020

The core.stdc package is for standard C headers [1]. locale.h is a standard C header, but libint.h is not—it is part of GNU gettext. The appropriate place for this is a package on code.dlang.org, not druntime.

[1] http://port70.net/~nsz/c/c99/n1256.html#7.1.2

@12345swordy
Copy link
Contributor

@WalterBright what do you think?

Copy link
Member

@Geod24 Geod24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @pbackus this should be a dub package. The only need that this could have in druntime was if we were using it. druntime itself is not a binding library.

Code wise, there's two issues:

  1. Attributes are missing. This should be @system nothrow @nogc.
  2. There's some long int here. For C long type, you should use c_long, as it's 4 bytes in 32 bits (unlike D's long).

@adelavais
Copy link
Author

Thank you so much for your feedback! I made a dub package instead (https://code.dlang.org/packages/libintl) and I will close this PR.

@adelavais adelavais closed this Dec 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants