logo

libbulletml

Library of Bullet Markup Language (forked from https://shinh.skr.jp/libbulletml/index_en.html )git clone https://anongit.hacktivis.me/git/libbulletml.git/

cpp_test.d (968B)


  1. import cpp_inter;
  2. import stream;
  3. import string;
  4. extern (C) {
  5. int return7(D_I* i) { return 7; }
  6. int add(D_I* i, int x, int y) { return x+y; }
  7. }
  8. int main() {
  9. D_C* c = D_C_new_1(1);
  10. stdout.writeLine(string.toString(D_C_a(c)));
  11. D_C_delete(c);
  12. c = D_C_new();
  13. D_C_setA(c, 2);
  14. stdout.writeLine(string.toString(D_C_a(c)));
  15. D_C_f2(c, 0, 0);
  16. D_C_f5(c, 0,0,0,0,0);
  17. D_C_f9(c, 0,0,0,0,0,0,0,0,0);
  18. D_C_over_load_int(c, 3);
  19. stdout.writeLine(string.toString(D_C_a(c)));
  20. D_C_over_load_char(c, '4');
  21. stdout.writeLine(string.toString(D_C_a(c)));
  22. D_TC_int* tc = D_TC_int_new();
  23. stdout.writeLine(string.toString(D_TC_int_f(tc)));
  24. stdout.writeLine(string.toString(D_TC_int_tf(tc)));
  25. D_C_delete(c);
  26. D_TC_int_delete(tc);
  27. D_I* i = D_I_new();
  28. D_I_setCallbackFunc(i, &return7);
  29. D_I_setCallback2Func(i, &add);
  30. stdout.writeLine(string.toString(D_I_load_callback(i)));
  31. stdout.writeLine(string.toString(D_I_load_callback2(i, 3, 5)));
  32. D_I_delete(i);
  33. return 0;
  34. }