Who know how use FB swig?

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

Who know how use FB swig?

Postby ~EXIS~ » Jan 29, 2008 17:47

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

Postby Bunuel66 » Jan 29, 2008 19:47

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

Postby TDT » Jan 29, 2008 20:26

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

Postby Bunuel66 » Jan 29, 2008 23:17

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

Postby ~EXIS~ » Jan 30, 2008 18:20

Bunuel66 wrote:http://www.freebasic.net/temp/swig_fb.zip


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

Postby Bunuel66 » Jan 30, 2008 20:22

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

Postby ~EXIS~ » Jan 30, 2008 21:08

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

Postby Bunuel66 » Jan 30, 2008 21:28

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

Postby ~EXIS~ » Jan 31, 2008 16:04

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

Postby sir_mud » Jan 31, 2008 23:12

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: 3800
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Feb 02, 2008 14:15

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.

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 1 guest