]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOS9/mDNSLibraryLoader.c
mDNSResponder-108.tar.gz
[apple/mdnsresponder.git] / mDNSMacOS9 / mDNSLibraryLoader.c
1 /*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22
23 Change History (most recent first):
24
25 $Log: mDNSLibraryLoader.c,v $
26 Revision 1.1 2004/03/12 21:30:26 cheshire
27 Build a System-Context Shared Library from mDNSCore, for the benefit of developers
28 like Muse Research who want to be able to use mDNS/DNS-SD from GPL-licensed code.
29
30 */
31
32 #include <Resources.h>
33 #include <CodeFragments.h>
34 #include "ShowInitIcon.h"
35
36 extern pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister);
37
38 extern void main(void)
39 {
40 OSStatus err;
41 FCBPBRec fcbPB;
42 FSSpec fss;
43
44 // 1. Show our "icon march" icon
45 ShowInitIcon(128, true);
46
47 // 2. Find our FSSpec
48 fss.name[0] = 0;
49 fcbPB.ioNamePtr = fss.name;
50 fcbPB.ioVRefNum = 0;
51 fcbPB.ioRefNum = (short)CurResFile();
52 fcbPB.ioFCBIndx = 0;
53 err = PBGetFCBInfoSync(&fcbPB);
54
55 // 3. Tell CFM that we're a CFM library container file
56 fss.vRefNum = fcbPB.ioFCBVRefNum;
57 fss.parID = fcbPB.ioFCBParID;
58 if (err == noErr) err = FragRegisterFileLibs(&fss, false);
59
60 // 4. Now that CFM knows we're a library container, tell it to go and get our library
61 if (err == noErr)
62 {
63 CFragConnectionID c;
64 Ptr m;
65 Str255 e;
66 THz oldZone = GetZone();
67 SetZone(SystemZone());
68 err = GetSharedLibrary("\pDarwin;mDNS", kPowerPCCFragArch, kLoadCFrag, &c, &m, e);
69 SetZone(oldZone);
70 }
71 }
72
73 // There's no CFM stub library for the FragRegisterFileLibs() call, so we'll make our own
74 #if __ide_target("FragRegisterFileLibsStub")
75 #pragma export on
76 pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister)
77 {
78 (void)fss; // Unused
79 (void)unregister; // Unused
80 return(0);
81 }
82 #endif