Date: Tue, 4 Mar 1997 13:57:51 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: guido@gvr.win.tue.nl (Guido van Rooij) Cc: terry@lambert.org, FreeBSD-hackers@freebsd.org Subject: Re: gcc question Message-ID: <199703042057.NAA10366@phaeton.artisoft.com> In-Reply-To: <199703042032.VAA03138@gvr.win.tue.nl> from "Guido van Rooij" at Mar 4, 97 09:32:43 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > > I've got a question about interfacing between `normal' c and -traditional. > > > > > > 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). > > > > Compile the ANSI C code without a prototype in scope, and it will use > > "traditional" stack type promotion calling conventions. > > > > As I specifically told in my mail, I do not have the ansi c api source. Then you must create a stub function, eg: /* * the prototype for the real thing must be in scope for this * compilation */ #include "api_header.h" /* * Stub, compiled without prototype for stub_apicall() in scope, * but *with* prototype for apicall() in scope. */ stub_apicall( xxx) { /* * Calls real thing, compiled with prototype in scope */ return apicall( xxx) } ... /* * other stup_apicalls.... */ ... Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703042057.NAA10366>