Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!rna!kc From: kc@rna.UUCP (Kaare Christian) Newsgroups: comp.lang.c++ Subject: Re: Zortech C++ vs Metagraphics Metawindow vs various linkers Summary: C vs. C++ linkage, and outside libraries Message-ID: <859@rna.UUCP> Date: 28 Nov 89 16:14:31 GMT References: <870@sys.uea.ac.uk> <24525@cup.portal.com> Organization: Rockefeller University - Neurobiology Lines: 28 In article <24525@cup.portal.com>, Nagle@cup.portal.com (John - Nagle) writes: > > I've recently upgraded to Zortech 2.0, and am trying to recompile a > previously-working program that uses Metagraphics Metawindow. The result > is a finger-pointing exercise involving Zortech, Metagraphics, and Polytran. I don't have a solution for this particular problem, but I would like to throw in my two cents on the topic of using external libraries and device drivers with ztc 2.0. I had a working 1.07 ztc program that linked with an external library supplied by #9 computer (nnios). Their library is just glue that hooks up to their device driver, which then goes out to a special graphics board. Anyway, getting that previously working setup to work with ztc 2.0 required: 1. Fixing up the declarations and function prototypes. There was a half day's work here, because the old declarations were sloppy, and not all of the actual functions matched the prototypes exactly. 2. Fixing up the linkage. This took a while to find. The nnios library accesses their device driver via a far function pointer, which is made to point at the driver entry point. The device driver, originally written to work with C, does a far return and follows ordinary C stack cleanup conventions. Unfortunately the far pointer's declaration was embedded in code using C++ linkage, hence ztc was generating C++ style calls and cleanups. Anyway, switching the pointer declaration to C linkage made everything work. This was unpleasant to find because there aren't any error messages, and each trial lead to a system crash. Kaare Christian kc@rna.rockefeller.edu