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