home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.ultrix:8225 comp.sys.dec:5876
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!swrinde!cs.utexas.edu!ut-emx!trillium!brook
- From: brook@trillium.BOTANY.UTEXAS.EDU (Brook Milligan)
- Newsgroups: comp.unix.ultrix,comp.sys.dec
- Subject: fortran complex*16 for RISC
- Message-ID: <1403@trillium.BOTANY.UTEXAS.EDU>
- Date: 10 Nov 92 23:19:00 GMT
- Followup-To: poster
- Organization: Dept. of Botany, Univ. of Texas, Austin
- Lines: 108
-
- I am trying to compile a program that uses fortran functions involving
- complex numbers. I have compiled the mathematical functions using f77
- and the c interface functions using gcc. When I link the object files
- I get the following message:
-
- /usr/lib/cmplrs/cc/ld:
- Undefined:
- math_div_dc_
-
- This error is a result of trying to do a complex division (as the
- following two functions will illustrate; if you compile and link them
- you will get the same message). If instead the types are complex*8,
- the same message is generated with a `fc' rather than a `dc' in the
- above function name.
-
- Presumably I need to include a library that provides complex
- arithmetic functions for fortran. What is the library that I need?
- This is on a decstation running ultrix 4.2 with the fortran 3.0
- compiler.
-
- Thanks for your help.
-
- Brook G. Milligan Internet: brook@trillium.botany.utexas.edu
- Department of Botany Bitnet: bohk313@utaivc
- University of Texas at Austin UUCP: ...!ut-emx!brook
- Austin, Texas 78713 U.S.A. (512) 471-3530 | FAX: (512) 471-3878
-
- ==================================== l.c ===========================================
-
- #include <math.h>
- #include <stdlib.h>
- #include <stdio.h>
-
- /*
- * ----------------------------------------------------------------------
- *
- * COMPLEX*16 type - for fortran interface
- *
- * ----------------------------------------------------------------------
- */
-
- struct _complex_16_info
- {
- double r; /* real component */
- double i; /* imaginary component */
- };
-
- typedef struct _complex_16_info COMPLEX_16;
-
- /*
- * ----------------------------------------------------------------------
- *
- * z - declare fortran function
- *
- * ----------------------------------------------------------------------
- */
-
- #define z z_ /* fortran external symbol name */
-
- extern void z (COMPLEX_16 * c, COMPLEX_16 * a, COMPLEX_16 * b);
-
- /*
- * ----------------------------------------------------------------------
- *
- * main
- *
- * ----------------------------------------------------------------------
- */
-
- int main (int argc, char * argv [])
- {
- COMPLEX_16 a;
- COMPLEX_16 b;
- COMPLEX_16 c;
-
- printf ("l() -- test of complex arithmetic\n");
-
- a . r = 1.0;
- a . i = 0.0;
- b . r = 2.0;
- b . i = 1.0;
-
- printf ("a: %f + i%-f\n", a . r, a . i);
- printf ("b: %f + i%-f\n", b . r, b . i);
-
- z (&c, &a, &b);
-
- printf ("c = a+b: %f + i%-f\n", c . r, c . i);
-
- return 0;
- }
-
- =================================== z.f =============================================
-
- subroutine z(c,a,b)
- complex*16 a,b,c
-
- c = a/b
-
- return
- end
-
- ================================================================================
- --
- Brook G. Milligan Internet: brook@trillium.botany.utexas.edu
- Department of Botany Bitnet: bohk313@utaivc
- University of Texas at Austin UUCP: ...!ut-emx!brook
- Austin, Texas 78713 U.S.A. (512) 471-3530 | FAX: (512) 471-3878
-