Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Oct 2014 21:25:37 +0300
From:      =?UTF-8?B?RGVuaXMgTWVuc2hpa292?= <dassi@inbox.ru>
To:        freebsd-virtualization@freebsd.org
Subject:   =?UTF-8?B?bGlidm1tYXBpLnNvIGFuZCBQZXJsIChsaWJ2bW1hcGkucG0p?=
Message-ID:  <1414520737.969914831@f87.i.mail.ru>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
 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
[-- Attachment #2 --]
clang -fPIC -c libvmmapi_wrap.c -I/usr/local/lib/perl5/5.16/mach/CORE -Dbool=char
In file included from libvmmapi_wrap.c:1533:
./vmmapi.h:63:16: warning: declaration of 'struct vm_exit'
      will not be visible outside of this function
      [-Wvisibility]
               struct vm_exit *ret_vmexit);
                      ^
./vmmapi.h:65:55: warning: declaration of
      'enum vm_event_type' will not be visible outside of
      this function [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_event_type type,
                                ^
./vmmapi.h:67:56: warning: declaration of
      'enum vm_event_type' will not be visible outside of
      this function [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_event_type type,
                                ^
./vmmapi.h:73:57: warning: declaration of 'enum vm_cap_type'
      will not be visible outside of this function
      [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_cap_type cap,
                                ^
./vmmapi.h:75:57: warning: declaration of 'enum vm_cap_type'
      will not be visible outside of this function
      [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_cap_type cap,
                                ^
libvmmapi_wrap.c:2610:41: warning: incompatible pointer types
      passing 'struct vm_exit *' to parameter of type
      'struct vm_exit *' [-Wincompatible-pointer-types]
    result = (int)vm_run(arg1,arg2,arg3,arg4);
                                        ^~~~
./vmmapi.h:63:25: note: passing argument to parameter
      'ret_vmexit' here
               struct vm_exit *ret_vmexit);
                               ^
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);
           ^
libvmmapi_wrap.c:2725:10: note: forward declaration of 'enum
      vm_event_type'
    enum vm_event_type arg3 ;
         ^
libvmmapi_wrap.c:2936:22: error: variable has incomplete type
      'enum vm_cap_type'
    enum vm_cap_type arg3 ;
                     ^
libvmmapi_wrap.c:2936:10: note: forward declaration of
      'enum vm_cap_type'
    enum vm_cap_type arg3 ;
         ^
libvmmapi_wrap.c:2967:12: error: cast to incomplete type
      'enum vm_cap_type'
    arg3 = (enum vm_cap_type)(val3);
           ^
libvmmapi_wrap.c:2936:10: note: forward declaration of
      'enum vm_cap_type'
    enum vm_cap_type arg3 ;
         ^
libvmmapi_wrap.c:2994:22: error: variable has incomplete type
      'enum vm_cap_type'
    enum vm_cap_type arg3 ;
                     ^
libvmmapi_wrap.c:2994:10: note: forward declaration of
      'enum vm_cap_type'
    enum vm_cap_type arg3 ;
         ^
libvmmapi_wrap.c:3025:12: error: cast to incomplete type
      'enum vm_cap_type'
    arg3 = (enum vm_cap_type)(val3);
           ^
libvmmapi_wrap.c:2994:10: note: forward declaration of
      'enum vm_cap_type'
    enum vm_cap_type arg3 ;
         ^
libvmmapi_wrap.c:3626:23: error: variable has incomplete type
      'enum x2apic_state'
    enum x2apic_state arg3 ;
                      ^
./vmmapi.h:33:6: note: forward declaration of
      'enum x2apic_state'
enum x2apic_state;
     ^
libvmmapi_wrap.c:3654:12: error: cast to incomplete type
      'enum x2apic_state'
    arg3 = (enum x2apic_state)(val3);
           ^
./vmmapi.h:33:6: note: forward declaration of
      'enum x2apic_state'
enum x2apic_state;
     ^
6 warnings and 10 errors generated.

[-- Attachment #3 --]
clang -fPIC -c libvmmapi_wrap.c -I/usr/local/lib/perl5/5.16/mach/CORE -Dbool=char
In file included from libvmmapi_wrap.c:1543:
./vmmapi.h:63:16: warning: declaration of 'struct vm_exit'
      will not be visible outside of this function
      [-Wvisibility]
               struct vm_exit *ret_vmexit);
                      ^
./vmmapi.h:65:55: warning: declaration of
      'enum vm_event_type' will not be visible outside of
      this function [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_event_type type,
                                ^
./vmmapi.h:67:56: warning: declaration of
      'enum vm_event_type' will not be visible outside of
      this function [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_event_type type,
                                ^
./vmmapi.h:73:57: warning: declaration of 'enum vm_cap_type'
      will not be visible outside of this function
      [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_cap_type cap,
                                ^
./vmmapi.h:75:57: warning: declaration of 'enum vm_cap_type'
      will not be visible outside of this function
      [-Wvisibility]
  ...vmctx *ctx, int vcpu, enum vm_cap_type cap,
                                ^
libvmmapi_wrap.c:2695:41: warning: incompatible pointer types
      passing 'struct vm_exit *' to parameter of type
      'struct vm_exit *' [-Wincompatible-pointer-types]
    result = (int)vm_run(arg1,arg2,arg3,arg4);
                                        ^~~~
./vmmapi.h:63:25: note: passing argument to parameter
      'ret_vmexit' here
               struct vm_exit *ret_vmexit);
                               ^
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,
                                ^
libvmmapi_wrap.c:3058:47: error: argument type
      'enum vm_cap_type' is incomplete
    result = (int)vm_get_capability(arg1,arg2,arg3,arg4);
                                              ^~~~
./vmmapi.h:73:57: note: forward declaration of
      'enum vm_cap_type'
  ...vmctx *ctx, int vcpu, enum vm_cap_type cap,
                                ^
libvmmapi_wrap.c:3116:47: error: argument type
      'enum vm_cap_type' is incomplete
    result = (int)vm_set_capability(arg1,arg2,arg3,arg4);
                                              ^~~~
./vmmapi.h:75:57: note: forward declaration of
      'enum vm_cap_type'
  ...vmctx *ctx, int vcpu, enum vm_cap_type cap,
                                ^
6 warnings and 4 errors generated.

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1414520737.969914831>