Thread overview
Anyone tried wrapping DMD with Swig?
Aug 09, 2012
Andrej Mitrovic
Aug 09, 2012
David Nadlinger
Aug 09, 2012
Andrej Mitrovic
August 09, 2012
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.
August 09, 2012
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
August 09, 2012
On 8/9/12, David Nadlinger <see@klickverbot.at> wrote:
> Have you
> tried adding a »%module dmd« directive to the top of your .i
> file?

That fixes it, thanks.