1*1230fdc1SLionel Sambuc /*
2*1230fdc1SLionel Sambuc ** Copyright (c) 2001-2009 Expat maintainers.
3*1230fdc1SLionel Sambuc **
4*1230fdc1SLionel Sambuc ** Permission is hereby granted, free of charge, to any person obtaining
5*1230fdc1SLionel Sambuc ** a copy of this software and associated documentation files (the
6*1230fdc1SLionel Sambuc ** "Software"), to deal in the Software without restriction, including
7*1230fdc1SLionel Sambuc ** without limitation the rights to use, copy, modify, merge, publish,
8*1230fdc1SLionel Sambuc ** distribute, sublicense, and/or sell copies of the Software, and to
9*1230fdc1SLionel Sambuc ** permit persons to whom the Software is furnished to do so, subject to
10*1230fdc1SLionel Sambuc ** the following conditions:
11*1230fdc1SLionel Sambuc **
12*1230fdc1SLionel Sambuc ** The above copyright notice and this permission notice shall be included
13*1230fdc1SLionel Sambuc ** in all copies or substantial portions of the Software.
14*1230fdc1SLionel Sambuc **
15*1230fdc1SLionel Sambuc ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16*1230fdc1SLionel Sambuc ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17*1230fdc1SLionel Sambuc ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18*1230fdc1SLionel Sambuc ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19*1230fdc1SLionel Sambuc ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20*1230fdc1SLionel Sambuc ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21*1230fdc1SLionel Sambuc ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*1230fdc1SLionel Sambuc */
23*1230fdc1SLionel Sambuc
24*1230fdc1SLionel Sambuc #ifdef __USE_INLINE__
25*1230fdc1SLionel Sambuc #undef __USE_INLINE__
26*1230fdc1SLionel Sambuc #endif
27*1230fdc1SLionel Sambuc
28*1230fdc1SLionel Sambuc #include <stdlib.h>
29*1230fdc1SLionel Sambuc #include <proto/exec.h>
30*1230fdc1SLionel Sambuc
31*1230fdc1SLionel Sambuc struct Library* ExpatBase = 0;
32*1230fdc1SLionel Sambuc struct ExpatIFace* IExpat = 0;
33*1230fdc1SLionel Sambuc
34*1230fdc1SLionel Sambuc
35*1230fdc1SLionel Sambuc void setup() __attribute__((constructor));
36*1230fdc1SLionel Sambuc void cleanup() __attribute__((destructor));
37*1230fdc1SLionel Sambuc
38*1230fdc1SLionel Sambuc
setup()39*1230fdc1SLionel Sambuc void setup()
40*1230fdc1SLionel Sambuc {
41*1230fdc1SLionel Sambuc ExpatBase = IExec->OpenLibrary("expat.library", 53);
42*1230fdc1SLionel Sambuc IExpat = (struct ExpatIFace*)IExec->GetInterface(ExpatBase, "main", 1, NULL);
43*1230fdc1SLionel Sambuc
44*1230fdc1SLionel Sambuc if ( IExpat == 0 ) {
45*1230fdc1SLionel Sambuc IExec->DebugPrintF("Can't open expat.library\n");
46*1230fdc1SLionel Sambuc }
47*1230fdc1SLionel Sambuc }
48*1230fdc1SLionel Sambuc
49*1230fdc1SLionel Sambuc
cleanup()50*1230fdc1SLionel Sambuc void cleanup()
51*1230fdc1SLionel Sambuc {
52*1230fdc1SLionel Sambuc IExec->DropInterface((struct Interface*)IExpat);
53*1230fdc1SLionel Sambuc IExpat = 0;
54*1230fdc1SLionel Sambuc
55*1230fdc1SLionel Sambuc IExec->CloseLibrary(ExpatBase);
56*1230fdc1SLionel Sambuc ExpatBase = 0;
57*1230fdc1SLionel Sambuc }
58