Last active
June 6, 2018 09:52
-
-
Save shelajev/85654dc1216556888a69665ab41738bd to your computer and use it in GitHub Desktop.
big-integer-demo.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <polyglot.h> | |
| int main() { | |
| void *bigInteger = polyglot_java_type("java.math.BigInteger"); | |
| void *(*BigInteger_valueOf)(long) = polyglot_get_member(bigInteger, "valueOf"); | |
| void *bi = BigInteger_valueOf(2); | |
| void *result = polyglot_invoke(bi, "pow", 256); | |
| char buffer[100]; | |
| polyglot_as_string(polyglot_invoke(result, "toString"), | |
| buffer, | |
| sizeof(buffer), | |
| "ascii"); | |
| printf("%s\n", buffer); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment