| 1 |
|
| 2 |
/* Example of a C++ extension to icon via loadfunc, |
| 3 |
* without garbage collection difficulties. |
| 4 |
* Type 'make iexample' to build. |
| 5 |
* Carl Sturtivant, 2007/9/25 |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "loadfuncpp.h" |
| 9 |
|
| 10 |
#include<stdio.h> |
| 11 |
|
| 12 |
extern "C" int iexample(value argv[]) { |
| 13 |
safe callme(argv[1]), text(argv[2]); |
| 14 |
printf("Calling callme\n"); |
| 15 |
callme(); |
| 16 |
printf("Callme returned\n"); |
| 17 |
printf("Calling callme\n"); |
| 18 |
callme(); |
| 19 |
printf("Callme returned\n"); |
| 20 |
//Icon::runerr(123, text); |
| 21 |
return FAILED; |
| 22 |
} |
| 23 |
|
| 24 |
extern "C" int iexample2(value argv[]) { |
| 25 |
//Icon::display(&Icon::level, &Icon::output); |
| 26 |
safe nextcall(argv[1]), rerr(argv[2]); |
| 27 |
nextcall(); |
| 28 |
rerr(123, "Bye!"); |
| 29 |
//Icon::runerr(123, "Bye!"); |
| 30 |
return FAILED; |
| 31 |
} |