Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!cbmvax!carolyn From: carolyn@cbmvax.UUCP Newsgroups: comp.sys.amiga Subject: Re: A shared library (mostly) in C Message-ID: <1999@cbmvax.cbmvax.cbm.UUCP> Date: Wed, 10-Jun-87 17:49:27 EDT Article-I.D.: cbmvax.1999 Posted: Wed Jun 10 17:49:27 1987 Date-Received: Sat, 13-Jun-87 05:34:07 EDT References: <10113@decwrl.DEC.COM> <1358@ulowell.cs.ulowell.edu> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Organization: Commodore Technology, West Chester, PA Lines: 39 In article <1358@ulowell.cs.ulowell.edu> page@ulowell.cs.ulowell.edu (Bob Page) writes: >[] >Now that we can write our own C libraries, how do we handle name conflicts? >If I have (say) an "iff.library" that has an IFF read routine called >"iffread" and you have a library for your application called "myapp.library" >that also has a routine called "iffread", which one gets used, mine or yours, >assuming you call OpenLibrary() on both libraries? >[] >Anyway, how do we avoid colliding function names in run-time libraries? >I mean besides appending a "unique" string to the function name... Assuming you have also written an Amiga.lib type linker library to interface with your library functions and allow you to call them by name in a C program, the linker will resolve it with the first match it comes across. So you decide which of two conflicting-name functions you get by simply specifying the proper .lib order in your link. I consider this a feature since it allows me, for example, to use Amiga.lib's AmigaDOS stdio printf() and getchar() rather than Lattice's stdio, giving me Greenhill's compatibility. I believe others (Matt Dillon?) have written their own stdio .lib's which they link with first so that all stdio functions used are theirs. Of course, if you need to use both same-name functions, you'll have to write yourself a small assembler stub with a different name which will specifically call the second one for you. But don't blame the OS. Executable programs are not calling functions by name. By that time, the code is just the first thing the linker found that matched that function name. This might be a function name in your own code. If not, then it's the code from the first .lib containing that label. In either case, any labels hanging around after that are just for debugging purposes. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CBM >>Amiga Technical Support<< UUCP ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=