libvmmapi.so and Perl (libvmmapi.pm)
Denis Menshikov
dassi at inbox.ru
Tue Oct 28 18:25:55 UTC 2014
Good day!
I'm trying to bind to libvmmapi.so on Perl. For this purpose I use swig (ported to FreeBSD 10).
All my manipulations I do in the test directory in which you extracted the archive src.txz, in the directory /tmp/test/usr/src/lib/libvmmapi/ .
user# ls
Makefile
libvmmapi.i
libvmmapi.pm vmmapi.c
libvmmapi_wrap.c vmmapi.h
vmmapi_freebsd.c
Use the following swig interface file:
%module libvmmapi
%{
#include "vmmapi.h"
%}
%include "vmmapi.h"
Output errors of the following type (File 1):
libvmmapi_wrap.c:2667:24: error: variable has incomplete type
'enum vm_event_type'
enum vm_event_type arg3 ;
^
libvmmapi_wrap.c:2667:10: note: forward declaration of 'enum
vm_event_type'
enum vm_event_type arg3 ;
^
libvmmapi_wrap.c:2698:12: error: cast to incomplete type
'enum vm_event_type'
arg3 = (enum vm_event_type)(val3);
^
libvmmapi_wrap.c:2667:10: note: forward declaration of 'enum
vm_event_type'
enum vm_event_type arg3 ;
^
libvmmapi_wrap.c:2725:24: error: variable has incomplete type
'enum vm_event_type'
enum vm_event_type arg3 ;
^
libvmmapi_wrap.c:2725:10: note: forward declaration of 'enum
vm_event_type'
enum vm_event_type arg3 ;
^
libvmmapi_wrap.c:2759:12: error: cast to incomplete type
'enum vm_event_type'
arg3 = (enum vm_event_type)(val3);
Then,I suggested that enum 'enum vm_event_type' is not defined. Because the file vmmapi.c includes vmm.h I found the definition of the enumeration, and changed the interface file.
%module libvmmapi
%{
#include "vmmapi.h"
#include "vmm.h"
%}
%include "vmmapi.h"
%include "vmm.h"
Include vmm.h (copying it into the work (test) directory ) had, As it is defined enum vm_event_type.
Now we have the error of only one type (File 2):
libvmmapi_wrap.c:2789:45: error: argument type 'enum
vm_event_type' is incomplete
result = (int)vm_inject_event(arg1,arg2,arg3,arg4);
^~~~
./vmmapi.h:65:55: note: forward declaration of 'enum
vm_event_type'
...vmctx *ctx, int vcpu, enum vm_event_type type,
^
libvmmapi_wrap.c:2855:46: error: argument type 'enum
vm_event_type' is incomplete
result = (int)vm_inject_event2(arg1,arg2,arg3,arg4,arg5);
^~~~
./vmmapi.h:67:56: note: forward declaration of 'enum
vm_event_type'
...vmctx *ctx, int vcpu, enum vm_event_type type,
I don't understand why 'arg3' is the argument of incomplete type 'enum vm_event_type' announced. Thank you.
P.S.
I hope the question is not offtopic. --
With best regards, Denis Menshikov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1
Type: application/octet-stream
Size: 4194 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-virtualization/attachments/20141028/3a9b57c6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2
Type: application/octet-stream
Size: 3067 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-virtualization/attachments/20141028/3a9b57c6/attachment-0001.obj>
More information about the freebsd-virtualization
mailing list