aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/PalmOS/Src/init_mathlib.cpp
blob: 1ea39c3e0a7a632af730b5c56ac4296cc599d11c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <PalmOS.h>

#include "globals.h"
#include "init_mathlib.h"
#include "mathlib.h"

Err MathlibInit() {
	Err e;

	if ((e = SysLibFind(MathLibName, &MathLibRef)))
		if (e == sysErrLibNotFound)									// couldn't find lib
			e = SysLibLoad(LibType, MathLibCreator, &MathLibRef);

	if (e) return sysErrLibNotFound;

	e = MathLibOpen(MathLibRef, MathLibVersion);
	return e;
}

void MathlibRelease() {
	UInt16 useCount;

	if (MathLibRef != sysInvalidRefNum) {
		MathLibClose(MathLibRef, &useCount);

		if (!useCount)
			SysLibRemove(MathLibRef);
	}
}