home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <inline/exec.h>
- struct Library *MathTransBase;
- struct Library *MathBase;
- struct Library *MathIeeeDoubBasBase;
- struct Library *MathIeeeDoubTransBase;
-
- void close_math(void)
- {
- if(MathBase) CloseLibrary(MathBase);
- if(MathTransBase) CloseLibrary(MathTransBase);
- if(MathIeeeDoubBasBase) CloseLibrary(MathIeeeDoubBasBase);
- if(MathIeeeDoubTransBase) CloseLibrary(MathIeeeDoubTransBase);
- }
-
- BOOL init_math(void)
- {
- atexit(close_math);
-
- MathBase = OpenLibrary((STRPTR)"mathffp.library",0L);
- MathTransBase = OpenLibrary((STRPTR)"mathtrans.library",0L);
- MathIeeeDoubTransBase = OpenLibrary((STRPTR)"mathieeedoubtrans.library",0L);
- MathIeeeDoubBasBase = OpenLibrary((STRPTR)"mathieeedoubbas.library",0L);
-
- if(MathBase && MathTransBase && MathIeeeDoubTransBase && MathIeeeDoubBasBase)
- return TRUE;
- else return FALSE;
- }
-
-
- int main(void )
- {
- float pi=3.14159265;
- float e=2.71;
- if(init_math())
- {
- /* now we can calculate something */
-
- return e*pi; /* will be truncated to an int */
- }
- else
- {
- Printf("Not able to open all math-libraries !\n");
- return 20;
- }
- }
-