PikeFramework
The following commands can be used to generate a program that uses the Pike framework: gcc -c itest.m -o itest.o gcc itest.o -o itest -framework Pike -framework Foundation #import <Pike/OCPikeInterpreter.h> #import <Foundation/NSAutoreleasePool.h> #import <Foundation/NSString.h>int main() { id i; struct svalue * sv; // required for console mode objective c applications NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc] init]; // these 3 lines set up and start the interpreter. i = [OCPikeInterpreter sharedInterpreter]; [i setMaster: @"/usr/local/pike/7.7.30/lib/master.pike"]; [i startInterpreter]; // ok, now that we have things set up, let's use it. // first, an example of calling pike c level apis directly. f_version(0); printf("%sn", Pike_sp[-1].u.string->str); pop_stack(); // next, we'll demonstrate one of the convenience functions available sv = [i evalString: @"1+2"]; printf("type: %d, value: %dn", sv->type, sv->u.integer); free_svalue(sv); // finally, we clean up. [i stopInterpreter]; [innerPool release]; return 0; } gcc -c ctest.m -o ctest.o gcc ctest.o -o TestBundle -framework Pike -framework Foundation -flat_namespace -bundle -Wl,-U,_environ cp TestBundle TestBundle.bundle/Contents/MacOS/ Powered by PikeWiki2 |
|||
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University |