Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Mar 1997 16:27:13 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        FreeBSD-hackers@freebsd.org, guido@gvr.win.tue.nl
Subject:   Re: gcc question
Message-ID:  <199703050527.QAA08806@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I have an API that is compiled with no -traditional flag that
>expects the folowing parameters:
>char *, char, char *
>
>I want to call this program from within something that has to be compiled
>with -traditional. When I'd call this api function the secod argument
>will be treated differently by the -traditional program and tha API
>function (for which I do not have the source). My question: how can
>I still interface between the two, without having to write a wrapper
>(becasue I think that is ugly).

Just declare a prototype for the function.  Prototypes work in traditional
mode.

If you want to compile with a K&R compiler (`gcc - traditional' is
not a K&R compiler), the try doing nothing.  There is nothing better,
since a K&R compiler can't pass an unpromoted (1 byte wide) char.
It may work, since the ANSI compiler that compiled the library may
promote char args anyway.  Gcc on i386's always promotes char args,
and everything works because i386's are little endian.  Gcc does this
because passing unpromoted char args is inefficient and incompatible
with traditional mode.  The FreeBSD syscall interface assumes this.
gcc pessimizes char args in other ways :-].  Don't use char, short
or float args.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703050527.QAA08806>