home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- #include <exec/types.h>
- #include <inline/exec.h>
- #include <clib/alib_protos.h>
-
- int atexit (void (*)(void));
-
- struct Library *MathTransBase;
- struct Library *MathBase;
- struct Library *MathIeeeDoubBasBase;
- struct Library *MathIeeeDoubTransBase;
- struct Library *UtilityBase;
-
-
- void close_math(void)
- {
- struct Library *lib;
- if(MathBase) { lib=(struct Library *)MathBase; CloseLibrary(lib); }
- if(MathTransBase) { lib=(struct Library *)MathTransBase; CloseLibrary(lib); }
- if(MathIeeeDoubBasBase) { lib=(struct Library *)MathIeeeDoubBasBase; CloseLibrary(lib); }
- if(MathIeeeDoubTransBase) { lib=(struct Library *)MathIeeeDoubTransBase; CloseLibrary(lib); }
- if(UtilityBase) { lib=(struct Library *)UtilityBase; CloseLibrary(lib); }
- }
-
- 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);
- UtilityBase = OpenLibrary((STRPTR)"utility.library",0L);
-
- if(MathBase && MathTransBase && MathIeeeDoubTransBase && MathIeeeDoubBasBase && UtilityBase)
- return TRUE;
- else return FALSE;
- }
-
-
- extern int u_random(void);
-
- int main(void)
- {
- if(init_math())
- {
- printf("Dies ist ein Test !!\n");
- printf("Zufall: %ld\n", u_random()&0xffff);
- }
- else
- {
- printf("Not able to open all math-libraries !\n");
- return 20;
- }
- }
-