dynamic_call-test.pwn 662 B

1234567891011121314151617181920212223242526272829
  1. #include "dynamic_call"
  2. forward test(i, &j, s[], t[]);
  3. main() {
  4. new x = 456;
  5. print("public - method #1");
  6. CallFunction(GetPublicAddressFromName("test"), 123, ref(x), ref("hell"), ref("yeah"));
  7. print("public - method #2");
  8. Push(123);
  9. Push(ref(x));
  10. Push(ref("hell"));
  11. Push(ref("yeah"));
  12. Call(GetPublicAddressFromName("test"));
  13. print("native - method #1");
  14. CallNativeByAddress(GetNativeAddressFromName("printf"), ref("Hello, %s!"), ref("World"));
  15. print("native - method #2");
  16. Push(ref("Hello, %s!"));
  17. Push(ref("World"));
  18. SysreqD(GetNativeAddressFromName("printf"));
  19. }
  20. public test(i, &j, s[], t[]) {
  21. printf("test: %d %d %s %s", i, j, s, t);
  22. }