]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOS9/mDNSLibraryLoader.c
mDNSResponder-107.6.tar.gz
[apple/mdnsresponder.git] / mDNSMacOS9 / mDNSLibraryLoader.c
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16
17 Change History (most recent first):
18
19 $Log: mDNSLibraryLoader.c,v $
20 Revision 1.2 2006/08/14 23:24:29 cheshire
21 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
22
23 Revision 1.1 2004/03/12 21:30:26 cheshire
24 Build a System-Context Shared Library from mDNSCore, for the benefit of developers
25 like Muse Research who want to be able to use mDNS/DNS-SD from GPL-licensed code.
26
27 */
28
29 #include <Resources.h>
30 #include <CodeFragments.h>
31 #include "ShowInitIcon.h"
32
33 extern pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister);
34
35 extern void main(void)
36 {
37 OSStatus err;
38 FCBPBRec fcbPB;
39 FSSpec fss;
40
41 // 1. Show our "icon march" icon
42 ShowInitIcon(128, true);
43
44 // 2. Find our FSSpec
45 fss.name[0] = 0;
46 fcbPB.ioNamePtr = fss.name;
47 fcbPB.ioVRefNum = 0;
48 fcbPB.ioRefNum = (short)CurResFile();
49 fcbPB.ioFCBIndx = 0;
50 err = PBGetFCBInfoSync(&fcbPB);
51
52 // 3. Tell CFM that we're a CFM library container file
53 fss.vRefNum = fcbPB.ioFCBVRefNum;
54 fss.parID = fcbPB.ioFCBParID;
55 if (err == noErr) err = FragRegisterFileLibs(&fss, false);
56
57 // 4. Now that CFM knows we're a library container, tell it to go and get our library
58 if (err == noErr)
59 {
60 CFragConnectionID c;
61 Ptr m;
62 Str255 e;
63 THz oldZone = GetZone();
64 SetZone(SystemZone());
65 err = GetSharedLibrary("\pDarwin;mDNS", kPowerPCCFragArch, kLoadCFrag, &c, &m, e);
66 SetZone(oldZone);
67 }
68 }
69
70 // There's no CFM stub library for the FragRegisterFileLibs() call, so we'll make our own
71 #if __ide_target("FragRegisterFileLibsStub")
72 #pragma export on
73 pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister)
74 {
75 (void)fss; // Unused
76 (void)unregister; // Unused
77 return(0);
78 }
79 #endif