From owner-freebsd-hackers Tue Mar 4 13:03:09 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA15696 for hackers-outgoing; Tue, 4 Mar 1997 13:03:09 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id NAA15683 for ; Tue, 4 Mar 1997 13:03:06 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id NAA10366; Tue, 4 Mar 1997 13:57:51 -0700 From: Terry Lambert Message-Id: <199703042057.NAA10366@phaeton.artisoft.com> Subject: Re: gcc question To: guido@gvr.win.tue.nl (Guido van Rooij) Date: Tue, 4 Mar 1997 13:57:51 -0700 (MST) Cc: terry@lambert.org, FreeBSD-hackers@freebsd.org In-Reply-To: <199703042032.VAA03138@gvr.win.tue.nl> from "Guido van Rooij" at Mar 4, 97 09:32:43 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > > 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.