Who know how use FB swig?

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
~EXIS~
Posts: 21
Joined: Sep 01, 2006 18:57
Location: RUSSIA

Who know how use FB swig?

Post by ~EXIS~ »

Hwo know how use fb swig?
And were download it?
Im wont try parse directx november 2007 headers.
Bunuel66
Posts: 76
Joined: May 19, 2006 19:56

Post by Bunuel66 »

TDT
Posts: 32
Joined: Nov 16, 2005 22:34

Post by TDT »

I can't convert a .h file into .bi
All sintaxes that I try I got an error.

I create the .i file with
%module name
%include name.h

and I use: swig name.i
and I got many error (probably in each line)


Someone could give me the parameters?
Bunuel66
Posts: 76
Joined: May 19, 2006 19:56

Post by Bunuel66 »

Strange. It works for me using exactly the syntax as described.
Have you tried to convert something already available within the inc folder?

Maybe you can post an example of .h giving you an error as the error itself?

Regards

Luis
~EXIS~
Posts: 21
Joined: Sep 01, 2006 18:57
Location: RUSSIA

Post by ~EXIS~ »

ok i'm download it? but i can not understand how convert *.H file to *.bi?
what write into command line?
Bunuel66
Posts: 76
Joined: May 19, 2006 19:56

Post by Bunuel66 »

See message from TDT. How to use swig is described in the documentation.

Regards

Luis
~EXIS~
Posts: 21
Joined: Sep 01, 2006 18:57
Location: RUSSIA

Post by ~EXIS~ »

Ok i'm make name.i file with
%module dinput.h
%include dinput.h
make batch file
swig name.i
pause
and run it. The swig write any errors in console. How convert it?
Bunuel66
Posts: 76
Joined: May 19, 2006 19:56

Post by Bunuel66 »

When there is no error, swig generates a module.bi in the same directory.
That's it ;-)

Regards.

Luis
~EXIS~
Posts: 21
Joined: Sep 01, 2006 18:57
Location: RUSSIA

Post by ~EXIS~ »

Ok.
sir_mud
Posts: 1401
Joined: Jul 29, 2006 3:00
Location: US
Contact:

Post by sir_mud »

Even when swig finds errors it should still produce a partial .bi file, you will need to hand translate anything swig had problems with.
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Be sure you are using C headers that are compatible with gcc/mingw and don't depend on some VC++/windows-only feature, SWIG will choke on that.

This is the .i file i used to translate the Win API (and DX9):

Code: Select all

%module win

#define __i486__ 1
#define _M_IX86 1
#define __GNUC__ 3
#define NONAMELESSUNION 1
#define __stdcall
#define __fastcall
#define __cdecl
#define __attribute__(a)
#define _HAVE_INT64
#define __int64 long long
#define WINAPI 
#define APIENTRY

#define WIN32_LEAN_AND_MEAN 1
#define WIN32_WINNT 0x0700
#define _WIN32_WINNT WIN32_WINNT
#define WIN32_IE 0x0700
#define _WIN32_IE WIN32_IE
#define WIN32
#define _WIN32
#define WINVER 0x500

%include windows.h

#define DIRECTDRAW_VERSION 0x0700
#define DIRECTSOUND_VERSION 0x0900
#define DIRECTINPUT_VERSION 0x0800
/*#include ddraw.h
#include dsound.h
#include dinput.h
%include dxerr8.h
%include dxerr9.h*/

/*
#define DIRECT3D_VERSION 0x0900
%include d3d9.h
%include d3dx9.h*/

#define DIRECT3D_VERSION 0x0700
/*%include d3d.h
%include d3dx.h
%include d3drm.h
%include d3drmwin.h*/
To not make SWIG go nuts, i uncommented each header/api at once, "fixing" anything that went wrong by removing the unsupported "C" features or just by commenting out the lines and translating them by hand later.
Post Reply