aboutsummaryrefslogtreecommitdiff
path: root/scaf/system/scaf_feeder_test.c
blob: 23a2661458efe57d351352069855479f1e35625c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <dlfcn.h>

void scaf_feeder_asm (void *tos, void *reg, void (*ca_rule)(), void *env);

void ca_test() {}

main()
{
    int stack[256];
    int reg[8];
    int env[8];

    void *libhandle;
    void *ca_routine;


    if (!(libhandle = dlopen("../modules/test.scafo", RTLD_NOW))){
	printf("error: %s\n", dlerror());
	exit(1);
    }
    
    if (!(ca_routine = dlsym(libhandle, "carule_1"))){
	printf("error: %s\n", dlerror());
	exit(1);
    }

    scaf_feeder_asm(stack+254, reg, ca_routine, env);

    dlclose(libhandle);
}