[squeak-dev] Building a custom Plugin
Sean P. DeNigris
sean at clipperadams.com
Sun May 16 04:36:44 UTC 2010
I was following an example in "Squeak Open Personal Computing and Multimedia"
to make a really simple plugin.
InterpreterPlugin subclass: #ExamplePlugin
with one method:
ExamplePlugin class>>answerSeventeen
self export: true.
interpreterProxy
pop: 1
thenPush: (interpreterProxy integerObjectOf: 17)
The calling code is:
PluginUser>>usePluginPrimitive
<primitive: 'answerSeventeen' module: 'ExamplePlugin'>
^ ExamplePlugin doPrimitive: 'answerSeventeen'.
I translate with no problem with:
ExamplePlugin translateInDirectory: FileDirectory default doInlining:
true.
n.b. I chose true for doInlining: on the outcome of a game of
rock-paper-scissors, not really sure what the tradeoffs are here
Now here's where, several tutorials and dozens of web pages later, things
get... a little murky...
InterpreterSupportCode writeMacSourceFiles.
Oh boy, this class doesn't seem to exist in Pharo or Squeak trunk even
though it is mentioned by the tutorials.
Well, I read something about platform files somewhere, let's get those
working:
svn checkout http://squeakvm.org/svn/squeak/trunk/platforms/
Llet's try to compile it. Let's see what the tutorials have to say... uh
oh, one uses a 3rd-party IDE and the other two finish, to trumpets, with a
version of "Now, compile it to generate the library. Bye-bye."
C compiling a little rusty
<begin flopping around here>
gcc -I~/Squeak/platform ExamplePlugin.c
doh!
gcc -I/Users/sean/Squeak/platforms/Cross/vm/ ExamplePlugin.c
oops!
gcc -I/Users/sean/Squeak/platforms/Cross/vm/
-I/Users/sean/Squeak/platforms/Mac OS/vm/ ExamplePlugin.c
nope...
gcc -I/Users/sean/Squeak/platforms/Cross/vm/
-I/Users/sean/Squeak/platforms/Mac\ OS/vm/ ExamplePlugin.c
hmm....
gcc -I/Users/sean/Squeak/platforms/Cross/vm/
-I/Users/sean/Squeak/platforms/Mac\ OS/vm/
-I/Users/sean/Squeak/platforms/Mac\ OS/vm/Developer/ ExamplePlugin.c
I'm glad my mother's not watching...
gcc -I/Users/sean/Squeak/platforms/Cross/vm/
-I/Users/sean/Squeak/platforms/Mac\ OS/vm/
-I/Users/sean/Squeak/platforms/Mac\ OS/vm/Developer/ ExamplePlugin.c
maybe I should start a new career...
gcc -bundle -I/Users/sean/Squeak/platforms/Cross/vm/
-I/Users/sean/Squeak/platforms/Mac\ OS/vm/
-I/Users/sean/Squeak/platforms/Mac\ OS/vm/Developer/ ExamplePlugin.c
...snip...
gcc -bundle -framework Carbon
-I/Developer/SDKs/MacOSX10.6.sdk/Developer/Headers/FlatCarbon/
-I/Users/sean/Squeak/platforms/Cross/vm/ -I/Users/sean/Squeak/platforms/Mac\
OS/vm/ -I/Users/sean/Squeak/platforms/Mac\ OS/vm/Developer/ -o
ExamplePlugin.bundle ExamplePlugin.c
<end flopping around>
Well, it created *something*
So I moved it into the VM's Resources folder with the other plugins, shut
down the image, restarted, and... no go, still executing the "primitive
failed" code.
I may be missing something really simple here and forgive me if this is
incoherent - my brain is fried...
Where did I go wrong? And, what should I do now?
Thanks.
Sean
p.s. I used VMMakerTool "External Plugins" button, but it just put my .c
file in a different folder and created this file:
plugins.ext:
# Automatically generated makefile include for external plugins
EXTERNAL_PLUGINS = ExamplePlugin
--
View this message in context: http://forum.world.st/Building-a-custom-Plugin-tp2218276p2218276.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|