www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Anyone tried wrapping DMD with Swig?

reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
This is my .i file:
https://gist.github.com/3299941

I've ran:
swig -c++ -Isrc/root -IC:\MinGW\lib\gcc\mingw32\4.6.1\include
-IC:\MinGW\include -includeall -d -d2 dmd_all.i

C:\MinGW\include\stdlib.h(96) : Error: Syntax error in input(1).

Without using "-includeall" I get a lot of warnings but swig doesn't
generate a single file.

I don't really need the wrapper as I'm just doing this for testing
purposes. I've used my own codegenerator to create a wrapper but I
keep getting out of memory errors when trying to compile the D
wrapper, and I want to know if SWIG-generated code suffers from the
same problem or if I've just ran into a DMD bug.
Aug 08 2012
parent reply "David Nadlinger" <see klickverbot.at> writes:
On Thursday, 9 August 2012 at 00:28:32 UTC, Andrej Mitrovic wrote:
 This is my .i file:
 https://gist.github.com/3299941

 I've ran:
 swig -c++ -Isrc/root -IC:\MinGW\lib\gcc\mingw32\4.6.1\include
 -IC:\MinGW\include -includeall -d -d2 dmd_all.i

 C:\MinGW\include\stdlib.h(96) : Error: Syntax error in input(1).

 Without using "-includeall" I get a lot of warnings but swig 
 doesn't
 generate a single file.
Using -includeall is almost always the wrong thing to do, precisely for the reason that it also pulls in system headers. As for the »doesn't generate a single file« problem: Have you tried adding a »%module dmd« directive to the top of your .i file? David
Aug 08 2012
parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 8/9/12, David Nadlinger <see klickverbot.at> wrote:
 Have you
 tried adding a =BB%module dmd=AB directive to the top of your .i
 file?
That fixes it, thanks.
Aug 09 2012