Last active
April 19, 2018 10:52
-
-
Save cbaggers/47b4467b57ea8ca4eca74cf621415b51 to your computer and use it in GitHub Desktop.
Smaller test case
This file contains 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
#+sbcl | |
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(sb-int:set-floating-point-modes :traps nil)) | |
(defpackage :a (:use :cl)) | |
(in-package :a) | |
(cffi:define-foreign-library blort | |
(:darwin "/Users/Baggers/Library/Developer/Xcode/DerivedData/blort-ewxiurstjoibccbijgkxqrtyvtbu/Build/Products/Debug/libblort.dylib")) | |
(cffi:use-foreign-library blort) | |
(defun print! (x &rest args) | |
(format t "~%~a~{ ~s~}" x args) | |
(finish-output) | |
x) | |
;;void SDL_PumpEvents(void) | |
(cffi:defcfun ("Cocoa_Init" sdl_init) :void) | |
(cffi:defcfun ("Cocoa_PumpEvents" sdl_pump_events) :void) | |
(defun my-init () | |
(sdl_init)) | |
(defun my-pump () | |
(sdl_pump_events)) | |
(defun b () | |
#+ccl(let ((thread (find 0 (ccl:all-processes) :key #'ccl:process-serial-number))) | |
(ccl:process-interrupt thread #'do-it)) | |
#-ccl(do-it)) | |
(defun do-it () | |
(print! "hi") | |
(my-init) | |
(print! "next will poll a single event a bunch of times") | |
(print! (bt:all-threads)) | |
(print! (bt:current-thread)) | |
(loop :for i :below 300 :do (my-pump)) | |
(print! "done")) |
This file contains 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
#import "blort.h" | |
#include <ApplicationServices/ApplicationServices.h> | |
#include <Cocoa/Cocoa.h> | |
@interface BlortAppDelegate : NSObject <NSApplicationDelegate> | |
@end | |
@implementation BlortAppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSLog(@"applicationDidFinishLaunching"); | |
[NSApp activateIgnoringOtherApps:YES]; | |
} | |
@end | |
static BlortAppDelegate *appDelegate = nil; | |
extern void Cocoa_Init(void) | |
{ @autoreleasepool | |
{ | |
[NSApplication sharedApplication]; | |
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; | |
NSLog(@"\nFOIRST TROII!"); | |
[NSApp setDelegate:[[BlortAppDelegate alloc] init]]; | |
[NSApp finishLaunching]; | |
} | |
} | |
extern void Cocoa_PumpEvents(void) | |
{ @autoreleasepool | |
{ | |
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In xcode make a library project, add the
Cocoa.framework
, build.Tweak blort.lisp to give it to correct path
Doesnt crash ccl but does sbcl.
This code needs understanding and reducing further before we report this to any implementation. They shouldnt have to deal with this.