Compiled true plugins
-
Anyone work with true compiled plugins? I am curious to what is needed to go beyond the rugy scripts (I have an idea that I think will generate some income for my hobbies!)
Thanks,
Chris -
I'm working hard on this right now with an eventual goal of making certain PC only plugins that use Win32API available on the Mac.
Anyway, I've built the simplest possible .c ruby extension. It works perfectly in the ruby and irb instance under Leopard but when the .bundle is loaded in the Sketchup Ruby console I get a big ol crash right out of sketchup.
Does anyone have an example of a .bundle plugin that works properly with Sketchup 6 on the mac?
I'm wondering if it is a problem with mkmf using the OS level ruby (1.8.6?) and then trying to load and run with the Sketchup Ruby framework (1.8 i believe).
-
what does the stack trace say?
-
Looks like a null pointer issue. The crashlog shows:
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0Thread 0 Crashed:
0 libSystem.B.dylib 0x9233f47a __kill + 10
1 libSystem.B.dylib 0x923b6782 raise + 26
2 libSystem.B.dylib 0x923c5d3f abort + 73
3 com.google.rubyframework 0x01ab7e08 rb_bug + 243
4 com.google.rubyframework 0x01b1fddf sigbus + 49
5 libSystem.B.dylib 0x9233d97b _sigtramp + 43
6 ??? 0xffffffff 0 + 4294967295
7 libruby.1.dylib 0x1b319b48 rb_intern + 43
8 libruby.1.dylib 0x1b2d5d83 rb_define_module + 32
9 MyTest.bundle 0x17da0fb1 Init_MyTest + 27
10 com.google.rubyframework 0x01ab64bf dln_load + 197
11 com.google.rubyframework 0x01ad1110 rb_require_safe + 1123
12 com.google.rubyframework 0x01ac4235 rb_call0 + 666
13 com.google.rubyframework 0x01ac4d81 rb_call + 146
14 com.google.rubyframework 0x01ac1c51 rb_eval + 5731
15 com.google.rubyframework 0x01acfd88 eval + 999
16 com.google.rubyframework 0x01ad06a8 rb_eval_string + 97
17 com.google.rubyframework 0x01aba7ef rb_protect + 219
18 com.google.rubyframework 0x01aba81b rb_eval_string_protect + 40
19 com.AtLast.SketchUp 0x0024c783 0x1000 + 2406275
20 com.AtLast.SketchUp 0x00239ea4 0x1000 + 2330276
21 com.AtLast.SketchUp 0x00239f26 0x1000 + 2330406
22 com.apple.AppKit 0x926f0f94 -[NSApplication sendAction:to:from:] + 112
23 com.apple.AppKit 0x926f0ed4 -[NSControl sendAction:to:] + 108
24 com.apple.AppKit 0x9278debc -[NSTextField textDidEndEditing:] + 847
25 com.apple.Foundation 0x9525477c _nsnote_callback + 364
26 com.apple.CoreFoundation 0x94516a4a __CFXNotificationPost + 362
27 com.apple.CoreFoundation 0x94516d23 _CFXNotificationPostNotification + 179
28 com.apple.Foundation 0x95251a70 -[NSNotificationCenter postNotificationName:object:userInfo:] + 128
29 com.apple.AppKit 0x9278d002 -[NSTextView(NSPrivate) _giveUpFirstResponder:] + 554
30 com.apple.AppKit 0x9278cdcd -[NSTextView(NSKeyBindingCommands) insertNewline:] + 543
31 com.apple.AppKit 0x9278cb6f -[NSResponder doCommandBySelector:] + 83
32 com.apple.AppKit 0x9278c9f8 -[NSTextView doCommandBySelector:] + 237
33 com.apple.AppKit 0x9277fb55 -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] + 1924
34 com.apple.AppKit 0x9277e762 -[NSTSMInputContext interpretKeyEvents:] + 1202
35 com.apple.AppKit 0x9277e27c -[NSView interpretKeyEvents:] + 70
36 com.apple.AppKit 0x9277e18a -[NSTextView keyDown:] + 748
37 com.apple.AppKit 0x926ee8e2 -[NSWindow sendEvent:] + 8249
38 com.apple.AppKit 0x926baa2c -[NSApplication sendEvent:] + 2766
39 com.AtLast.SketchUp 0x00232eff 0x1000 + 2301695
40 com.apple.AppKit 0x92618705 -[NSApplication run] + 847
41 com.apple.AppKit 0x925e59ba NSApplicationMain + 574
42 com.AtLast.SketchUp 0x0000260a 0x1000 + 5642
43 com.AtLast.SketchUp 0x00002531 0x1000 + 5425 -
finally figured this out.
The ruby that ships with leopard is "frameworked" by Apple and linking with it creates plug-ins that will work at the OS level but crash sketchup.
I downloaded the regular version of ruby 1.8.6 and installed into usr/local/bin and then changed RUBY_HOME to point to the new one.
Now my compiled plugins work with Sketchup on Leopard!
Finally I can get back to the hard part of porting sketchyphysics to the mac...
Kevin
Advertisement