bindbc-icu 70.1.0
Dynamic and static bindings to IBM ICU, compatible with -betterC, @nogc, and nothrow.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
ICU(International Components for Unicode) for D
This project provides dynamic and static bindings to the C API of ICU(International Components for Unicode). The bindings are @nogc
and nothrow
compatible and can be compiled for compatibility with <s>-betterC
</s>.
-betterC
is is currently unsupported. It is blocked by Issue18472, which is caused by the metaprogramming we use internally.(A bounty is being placed on this issue.)
Usage
Documents are here (ICU4C) And bindbc-icu's API lists are here
If you are using dub, you can add a dependency by describing it as follows:
"dependencies": {
"bindbc-icu": "~>70.1",
}
On Windows, the package includes binaries, so you can use it as is. On Linux or MacOS, the ICU must be installed. Be sure to specify the version of the ICU.
apt install libicu-dev=70.1-2
If the required version is not provided by the package manager, you will need to build it from source code.
apt install -y git build-essential libicu-le-hb0 libicu-le-hb-dev
git clone -b release-70-1 --depth 1 --single-branch https://github.com/unicode-org/icu.git
cd icu/icu4c/source
./runConfigureICU Linux --disable-samples --disable-tests --with-data-packaging=library
make -j2
make install
Dynamic link
For dynamic linking, use subconfigurations in addition to dependencies.
"dependencies": {
"bindbc-icu": "~>70.1",
}
"subConfigurations": {
"bindbc-icu": "dynamic"
}
Then, initialize the dynamic link library as follows:
import bindbc.icu;
if (loadIcu() != IcuSupport.icu)
{
stderr.write("Failed to load the library");
return;
}
scope (exit)
unloadIcu();
bindbc.icu
bindbc.icu automatically selects and imports definitions(bindbc.icu.binddynamic
) for dynamic linking.
In particular, ICU functions are characterized by a versioned function name (symbol), but you can use the variable of function pointer without versions.
Inside the library, create the alias as following:
UCharsetDetector* ucsdet_open_70(UErrorCode* status) @system; // real symbol
typeof(&ucsdet_open_70) ucsdet_open; // usable function pointer from dynamic link libraries
Static link
For static linking, use subconfigurations in addition to dependencies.
"dependencies": {
"bindbc-icu": "~>70.1",
}
"subConfigurations": {
"bindbc-icu": "static"
}
Then, you can use any symbols of icu4c as following:
import bindbc.icu;
bindbc.icu
bindbc.icu automatically selects and imports definitions(bindbc.icu.bindstatic
) for static linking.
Then you can use ICU's C language function definitions and related structs, enums, etc.
In particular, ICU functions are characterized by a versioned function name (symbol), but you can use the aliasing name without versions.
Inside the library, create the alias as following:
UCharsetDetector* ucsdet_open_70(UErrorCode* status) @system; // real symbol
alias ucsdet_open = ucsdet_open_70; // usable alias
Support status
module | ||
---|---|---|
✅️ | ucsdet | Charset Detection |
✅️ | ucnv | Charset conversion |
✅️ | uloc | Locale information |
✅️ | ucurr | Currency information |
✅️ | parseerr | Parse Error Information |
✅️ | uformattable | Primitive types for formatting and parsing |
✅️ | udisplaycontext | Display context types (enum values) |
✅️ | ufieldpositer | Field Position Iterator for use with format APIs |
✅️ | unum | Compatibility APIs for number formatting |
✅️ | umisc | Miscellaneous types |
✘ | other |
Contributing
This project accepts Issue reports and PullRequests. The PullRequest must pass all tests in CI of GitHub Actions. First, make sure that your environment passes the test with the following commands.
rdmd scripts/runner.d -m=ut # or dub test
rdmd scripts/runner.d -m=it # or dub build / test / run for all ./testcases/* directories.
License
This library(bindbc-icu) is provided by provided under the BSL-1.0, but the ICU(ICU4C) on which this library depends is provided under the ICU License.
- Registered by mono_shoo
- 70.1.0 released 2 years ago
- shoo/bindbc-icu
- BSL-1.0
- Copyright © 2020, SHOO
- Authors:
- Dependencies:
- bindbc-loader
- Versions:
-
70.1.0 2022-Jul-30 69.1.0 2021-Apr-24 68.2.0 2021-Apr-24 67.1.0 2020-Aug-18 ~master 2022-Jul-30 - Download Stats:
-
-
0 downloads today
-
1 downloads this week
-
1 downloads this month
-
1604 downloads total
-
- Score:
- 0.6
- Short URL:
- bindbc-icu.dub.pm