#include <stddef.h>
#include <stdlib.h>
#include <libvhcall.h>
#include <stdio.h>
#define MAXLEN 100
const char *msg = "Hello, This is VE";
int main() {
int ret=1;
uint64_t len = MAXLEN;
char buf[MAXLEN];
int64_t symid;
vhcall_handle handle;
uint64_t retval = -1;
printf("Test for C library\n");
if (handle == (vhcall_handle)-1) {
perror("vhcall_install");
goto ret;
}
if (symid == -1 ) {
perror("vhcall_find");
goto ret2;
}
if (!ca) {
perror("vhcall_args_alloc");
goto ret2;
}
memcpy(buf, msg, strlen(msg));
memset(buf+strlen(msg)+1, '\0', MAXLEN-strlen(msg));
if (ret) {
perror("vhcall_args_set_pointer");
goto ret3;
}
if (ret) {
perror("vhcall_args_set_i32");
goto ret3;
}
if (ret) {
perror("vhcall_args_set_float");
goto ret3;
}
printf("[VE] buffer: %s\n", buf);
if (ret) {
perror("vhcall_invoke_with_args");
goto ret3;
}
printf("[VE] buffer: %s\n", buf);
if (retval) {
printf("VH function returns unexpected value(%ld)\n", retval);
goto ret3;
}
ret3:
ret2:
perror("vhcall_uninstall");
ret:
return ret;
}