CompuServe Thread

zc libs & linking

10 messages in this thread
#109778From: Aaron MinnerJun 23, 1990 12:06 PM
Anyone: Is zc.lib the startup lib for the zc compiler? If not, which lib is, and where do I find it? Are there any other libs I need to be aware of? Also, when you open a library, CBM or otherwise, does the library have to be in the libs directory, or is it included in the executable? I thought that's what we linked things for – to get them into the executable. Or are libraries different? Any help is greatly appreciated. Aaron
#109799From: Mike Spille/ManxJun 23, 1990 6:55 PM
Dunno about the zc startup library, but I can answer your second question. There are two types of libraries on the Amiga – link libraries and resident libraries. Link libraries are the libraries that you physically link in with your program, and are generally specified on your link invocation line. These libraries become a part of your executable. Resident libraries are the files you find in your LIBS: directory. As their name implies, resident libraries remain resident in the system – anybody can use them at anytime. They are _not_ part of your executable, but are loaded into memory when somebody does an OpenLibrary (). The neat thing about resident library is that even if 5 programs do an OpenLibrary() for a particular library, only one copy of that library is loaded into memory. -Mike
#109821From: Aaron MinnerJun 23, 1990 10:55 PM
Glad you straightened me out there, because I was beginning to think the Amiga wasn't worth the effort. I've been trying to figure how to program the simple Hello world program, but couldn't even do that because the differeces between libraries, what files are needed where, and other things like hthat aren't explained in any of the manuals I have (RKMS, Prog. Guide to Amiga). I've been fairly sheltered in my programming existence, using packaged compilers and linkers, so facing an environment where things are more open, and the compiler-person is more responsible for getting the basic things set up is one heck of a shock. Yeah, once I get the system set up, it shouldn't be a problem later, but just getting set up is taking me quite a bit of work. Like, I know what .obj files are in the clone world, but are they the same in the Amiga domain? Is lc.lib a standard library across compilers, even though it may be different for the various compilers, or what? I don't know. I know how to compile, bind, link, whatever…I just don't know which files I need, and these books, which I thought would help, aren't helping. Of course, I'm trying to get started up in a non-standard system (zc), but until I have a surplus of dough ($$) it'll have to do, but I'm still confoosed, you know? Could you give me a run-down of the basic assumptions that one requires before programming the Amiga? It would help. Aaron
#109884From: Mike Spille/ManxJun 24, 1990 3:29 PM
"a run-down of the basic assumtions that one requires before programming the Amiga" Wow, that's quite a bit of information. The Amiga environment is much more powerful than that on Clones. This means all sorts of nifty things can be done w/ an Amiga that would be difficult or impossible on PCs. The bad part is that powerful=complex. There's alot to learn, especially for programmers, and as you say you've got a significant handicap in that you're not using a commercial compiler. OK, well the basic things you're going to run into are: Header files, C source files, link-libraries, and resident libraries. Header files are files which get included into C-source using the C #include directive. There's two basic types of these – standard C includes and the Amiga #includes. The C includes are things like stdio.h, etc. which are portable across all C compilers. The Amiga #includes are things like intuition.h etc. which are specifically for doing Amiga stuff. You should be able to get the Amiga includes w/ the 1.3 Developer's kit from Commodore. These header files are standard across all Amiga C compilers. C source files are your actual programs, like 'hello.c' for a hello-world type program. Not much else to 'em. Link-libraries are libraries that get put into your program's executable file. The types of things you find in link libraries are program startup code, standard C functions like 'strcpy()', and 'glue' routines which are hooks into resident libraries. Resident libraries are libraries that are shared by all programs running on the machine. They are not part of your program's executable, but rather get loaded into memory through an OpenLibrary() call from a program. Object modules (fergot to include them above) are the intermediate files created by compilers and assemblers. To get them into executable programs you've got to link them first with one or more libraries. Header files generally end in '.h', C source in '.c', object modules in '.o' or '.obj', link-libraries in '.lib', and resident libraries in '.library'. These aren't hard-and-fast rules, but are the most widely used exte(CONT)
#109890From: Mike Spille/ManxJun 24, 1990 3:39 PM
(darn message length limit) The extensions aren't required, but the most commonly used ones. Your basic development cycle on the Amiga is the same as with other machines. You create your source file, compile it, possibly assemble it, link it, and run it. The only real problems you can encounter on setup are compiler searching for include files, linker searching for libraries, and linking the correct libraries in. For the 1st two, you generally just have to make an environment variable to point where your headers and libraries are, something along the lines of 'set INCLUDE=mydisk:include' and 'set CLIB=mydisk:libraries' (the actual syntax and commands will vary from compiler to compiler). As for the correct library, thats very specific to the compiler you're using. The only 'standard' library on the Amiga is amiga.lib, which is provided by Commodore. Beyond that library, you may very well need additional libraries – what they are depend on your compiler. The one requirement for Amiga programming is to get the RKM's (Rom Kernal Manuals). These are the official programming guides for the Amiga, and are essential if you want to do anything serious (or even semi-serious) on the Amiga. They don't attempt to teach you C though, so you should make sure you have a good C reference as well. -Mike
#110028From: Aaron MinnerJun 25, 1990 9:28 PM
Mike: That was pretty good, though most of it was redundant. I'm a software engineer at Motorola, and have worked with C for a couple of years, but, unfortunately, on clones with 'everything but the kitchen sink included' compilers, like Turbo C. The Amiga is one heck of a change, from the availability of a pd compiler that you have to either search for libs for or build your own, to a globally accessible library that you open up and close (sure, there are interrupts in ROM on clones, but they're hardly multi-taskable). This system seems more like unix than a personal computer, but I like it a lot (as of now, I'm running Access! in split screen, with your message in DME in the top half, with two shells underneath. Can't do that with a clone!). Your information was useful, though, because I wasn't sure of a few things. So, thanks for the run-down. I was a little confoosed because the stuff for zc wasn't all in one tidy little package, which I'm used to. It threw me off. Oh, by the way. I went through the RKMs and noticed that the libs weren't of the standard sort – at least, they didn't have names for the functions that I'm used to. Is this a problem with Amigas? I mean, if I want to port something to or from the clone world, it wouldn't be a straight port (multitasking aside) because of the change in functions. How's this addressed, if at all, on the Amiga side? Aaron
#110208From: Mike Spille/ManxJun 27, 1990 11:04 AM
The professional C compilers (Lattice and Manx) include pretty much all of the standard C functions in their own libraries. The stuff in the RKMs covers _only_ very Amiga specific functions for doing things with Intuition, Exec, Layers, etc. etc. I'm afraid many of the problems you're experiencing are due to the fact that you're using a PD compiler instead of a professional system – it's unfair to compare Turbo C to ZC since you pay for the former but not the latter. You may want to check out DICE, though – it seems to be a much better system than ZC. -Mike
#109930From: David M. DowdleJun 25, 1990 12:12 AM
The biggest 'basic assumption' to remember is that the system is multi-tasking. You _should_ de-allocate everything as soon as possible, because the system may "loose" memery at any moment to another program. Also, it is much more important to correctly clean-up after the program, and to never violate CBM 'programming laws", do to system interactions. David Dowdle
#110029From: Aaron MinnerJun 25, 1990 9:33 PM
Yeah, I noticed the list of 'laws' in the front of the RKMs. Well, some things are better specified in concrete terms, so there isn't any room for doubt. Two points: I *fully* realize that this system is multitasking ( I build multitasking systems at Motorola), and I always clean up my messes as soon as possible (a learned reflex from too many stray pointer bugs in early programming lessons). I was looking more for what libs are included where, and which libraries do what, but I got that information elsewhere. Thanks for the message, though. Aaron
#110261From: Christopher LapriseJun 28, 1990 12:09 AM
Aaron, as you have said that you work for Motorola (workstations, no less), I am extremely interested in what CPU you have your Amiga configured with. 🙂