Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watcgl.UUCP Path: utzoo!watmath!watcgl!gr From: gr@watcgl.UUCP (Gr Teaching Package) Newsgroups: net.unix Subject: accessing libm.a via pascal Message-ID: <1450@watcgl.UUCP> Date: Mon, 11-Mar-85 22:19:20 EST Article-I.D.: watcgl.1450 Posted: Mon Mar 11 22:19:20 1985 Date-Received: Tue, 12-Mar-85 00:00:31 EST Distribution: net Organization: U of Waterloo, Ontario Lines: 28 Students in one of my courses are using Pascal under Berkeley 4.2. They need to access several functions in the math library, but there doesn't seem to be an efficient, warning free technique. It seems that ``pc'' knows about the ``libm.a'' functions because it gives a duplicate definition warning if one defines such a function as external as is normally done for user-defined, external procedures. In spite of the warning, the math routine is linked correctly. If the external definition is omitted, ``pc'' generates an error message about the undefined function. I know of 2 methods to get around the warning: 1) Call an intermediate C function, ``foo'' that calls the appropriate math library routine. 2) Simulate the math routine in Pascal. Unfortunately this won't work for a function like ``pow(x,y)'' because its internal code sets a PSW flag (via an asm directive) to ignore underflow (generated when 0