Skip to content

Instantly share code, notes, and snippets.

@shelajev
Last active June 6, 2018 09:52
Show Gist options
  • Select an option

  • Save shelajev/85654dc1216556888a69665ab41738bd to your computer and use it in GitHub Desktop.

Select an option

Save shelajev/85654dc1216556888a69665ab41738bd to your computer and use it in GitHub Desktop.
big-integer-demo.c
#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