Advertisement
emacstheviking

Baffling domain error on foreign call

Nov 12th, 2020
1,893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
J 1.43 KB | None | 0 0
  1. cstring=: 3 : 'memr (>y),0,_1'
  2. sdl2lib =: '/usr/local/lib/libSDL2.dylib'
  3. sdlcd=: 1 : ('(''"',sdl2lib,'" '',u)&(15!:0)')
  4.  
  5. sdl_CreateWindowJ=:'SDL_CreateWindow * *c i i i i i' sdlcd
  6.  
  7. or this as a test stub in C to mimic the signature:
  8.  
  9. const char* window = "a window 0xaddress";
  10. const char* SDL_CreateWindow(const char* title, int x, int y, int w, int h, unsigned int flags){
  11.   return window;
  12. }
  13.  
  14. running it...
  15.  
  16.    sdl_CreateWindowJ 'this is a test';0;0;100;200;4
  17. sdl_CreateWindowJ 'this is a test';0;0;100;200;4
  18. ┌──────────┬──────────────┬─┬─┬───┬───┬─┐
  19. 4304518974│this is a test│001002004
  20. └──────────┴──────────────┴─┴─┴───┴───┴─┘
  21.    cstring=: 3 : 'memr (>y),0,_1'                                                                    
  22.  
  23. cstring=: 3 : 'memr (>y),0,_1'
  24.  
  25.       cstring <4304518974
  26. cstring <4304518974
  27. a window 0xaddress
  28.  
  29.  
  30. but then changing to use the '>' to discard the arguments and receive only the pointer...
  31.  
  32.    sdl_CreateWindowJ=:'SDL_CreateWindow > * * i i i i i' sdlcd
  33.  
  34. sdl_CreateWindowJ=:'SDL_CreateWindow > * * i i i i i' sdlcd
  35.  
  36.    sdl_CreateWindowJ 'this is a test';0;0;100;200;4
  37.  
  38. sdl_CreateWindowJ 'this is a test';0;0;100;200;4
  39. |domain error: sdl_CreateWindowJ
  40. |       sdl_CreateWindowJ'this is a test';0;0;100;200;4
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement