diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-07-08 14:57:05 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-11-24 23:37:04 +1000 |
commit | 1f9fa4a5329c6ac9bb09bffee53d071d17179c34 (patch) | |
tree | fd630aa25a0e36a56cfe10c770637c3d71c7300d /examples.ext/helloworld.c | |
parent | 7a8c0428cc8ec8098c2bb4a9ba2d6a2d597405e3 (diff) | |
download | jimtcl-1f9fa4a5329c6ac9bb09bffee53d071d17179c34.zip jimtcl-1f9fa4a5329c6ac9bb09bffee53d071d17179c34.tar.gz jimtcl-1f9fa4a5329c6ac9bb09bffee53d071d17179c34.tar.bz2 |
Create build-jim-ext for building extensions
Simplifies the process of building loadable extensions
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'examples.ext/helloworld.c')
-rw-r--r-- | examples.ext/helloworld.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples.ext/helloworld.c b/examples.ext/helloworld.c new file mode 100644 index 0000000..371a23d --- /dev/null +++ b/examples.ext/helloworld.c @@ -0,0 +1,24 @@ +/* + * hello.c -- A minimal Jim C extension. + */ +#include <jim.h> + +static int +Hello_Cmd(Jim_Interp *interp, int objc, Jim_Obj *const objv[]) +{ + Jim_SetResultString(interp, "Hello, World!", -1); + return JIM_OK; +} + +/* + * Jim_helloworldInit -- Called when Jim loads your extension. + * + * Note that the name *must* correspond exactly to the name of the extension: + * Jim_<extname>Init + */ +int +Jim_helloworldInit(Jim_Interp *interp) +{ + Jim_CreateCommand(interp, "hello", Hello_Cmd, NULL, NULL); + return JIM_OK; +} |