rmal@cernvax.UUCP (richard lucock) (03/20/90)
I have a question on the link libraries for Manx C (I have version 3.6a). If I compile the first example from the RKM (libs/devs), which opens a screen and a window, I get an unresolved reference when I try to link with c.lib only ( - can't find IntuitionBase). None of the other Manx libraries seem to have what is needed (although the arp.lib library does). Does anyone have any ideas as to how Manx would expect me to get this going without arp.lib ? Richard
mrush@csuchico.edu (Matt Rush) (03/21/90)
In article <1660@cernvax.UUCP> rmal@cernvax.UUCP (richard lucock) writes: >I have a question on the link libraries for Manx C (I have version 3.6a). >If I compile the first example from the RKM (libs/devs), which >opens a screen and a window, I get an unresolved reference >when I try to link with c.lib only ( - can't find IntuitionBase). None >of the other Manx libraries seem to have what is needed (although the >arp.lib library does). Does anyone have any ideas as to how Manx >would expect me to get this going without arp.lib ? Sounds like you aren't properly opening the Intuition.library. Try something along these lines: /* Just to be safe with Manx (especially if you use 16bit ints) */ void *OpenLibrary(), CloseLibrary(); /* Create a GLOBAL pointer called IntuitionBase -- this COULD even be a void * if you really want to... */ struct IntuitionBase * IntuitionBase; /* Misc. startup code */ /* BEFORE you call any Intuition functions (like opening windows) */ IntuitionBase = (struct IntuitionBase *)OpenLibrary("Intuition.library", 0l); if (IntuitionBase == NULL) /* Uh oh, didn't open */ {fprintf(stderr, "Phooey! Couldn't open the Intuition Library!\n"); exit(1); } /* Rest of Program */ /* CLOSE the library when you're done */ CloseLibrary(IntuitionBase); What all this does is Create a GLOBAL variable that the Manx libraries use in figuring Library Offsets for when you call an Amiga library function. If you don't declare IntuitionBase, all the library functions that need offsets based on that pointer will generate an unresolved reference. If you declare the pointer, but don't assign it using OpenLibrary() the program will compile and link, but will cause awful, terrible, horrible things to happen to the OS when you make your library calls. Closing the library just enables the OS to keep track of whether or not a loaded library is really being used -- if the use count goes to zero, the OS will flush it if it needs more memory. > >Richard -- Matt Oh yea, if I missed something, or gave bad info, the net is more than welcome to comment POLITELY. After all, this post has allegedly already cost thousands of dollars...