Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #54837

Re: libpng12 makes it impossible to compile gforth with C bindings

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: libpng12 makes it impossible to compile gforth with C bindings
Date 2017-02-13 14:18 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2017Feb13.151809@mips.complang.tuwien.ac.at> (permalink)
References <b99fe4bf-a20e-49b2-b177-0318ab54adde@googlegroups.com> <0dfeaaa2-61de-4b29-ad79-4787e228fc65@googlegroups.com> <2017Feb9.113754@mips.complang.tuwien.ac.at> <8ca887b9-b8a0-4eb0-8a31-3578b250aead@googlegroups.com>

Show all headers | View raw


anotherreepca@gmail.com writes:
>c-library sdl  ok
>\c #include <SDL2/SDL.h>  ok
>s" SDL2" add-lib  ok
>c-function sdl-init SDL_Init n -- n  ok
>end-c-library  In file included from /home/reepca/.gforth/amd64/libcc-named=
>/sdl.c:1:0:
>/usr/local/include/gforth/0.7.9_20170112/amd64/libcc.h:60:13: error: expect=
>ed =E2=80=98:=E2=80=99, =E2=80=98,=E2=80=99, =E2=80=98;=E2=80=99, =E2=80=98=
>}=E2=80=99 or =E2=80=98__attribute__=E2=80=99 before =E2=80=98.=E2=80=99 to=
>ken
> #define fp x.fpx

The problem here is that SDL.h defines a struct containing a field
"fp", and that does not work with this macro in place.  GCC now these
days points to the definition of the macro rather than its use, which
is not quite as confusing as pointing to the use (which looks
inconspicuous).

This problem does not show up in Gforth 0.7, because in Gforth 0.7 we
were smart enough to call the corresponding macro gforth_FP.  Thank
you for reporting this bug.

In the case of your SDL library, there is no reason not to include
<SDL2/SDL.h> first, but in general the \c lines may include code that
uses stuff from libcc.h, so in general libcc.h needs to come first.
Therefore the better approach is to use names that are unlikely to
collide with other stuff (like "gforth_FP").

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2016: http://www.euroforth.org/ef16/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

libpng12 makes it impossible to compile gforth with C bindings anotherreepca@gmail.com - 2017-02-03 18:46 -0800
  Re: libpng12 makes it impossible to compile gforth with C bindings anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-02-06 08:53 +0000
  Re: libpng12 makes it impossible to compile gforth with C bindings caleb.ristvedt@cune.org - 2017-02-08 14:59 -0800
    Re: libpng12 makes it impossible to compile gforth with C bindings anotherreepca@gmail.com - 2017-02-08 19:53 -0800
    Re: libpng12 makes it impossible to compile gforth with C bindings anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-02-09 10:37 +0000
      Re: libpng12 makes it impossible to compile gforth with C bindings anotherreepca@gmail.com - 2017-02-12 02:59 -0800
        Re: libpng12 makes it impossible to compile gforth with C bindings anotherreepca@gmail.com - 2017-02-12 13:04 -0800
          Re: libpng12 makes it impossible to compile gforth with C bindings anotherreepca@gmail.com - 2017-02-12 15:24 -0800
        Re: libpng12 makes it impossible to compile gforth with C bindings anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-02-13 14:18 +0000
          Compilation errors anotherreepca@gmail.com - 2017-02-14 17:10 -0800

csiph-web