diff options
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; +} |