aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/PalmOS/Src/init_mathlib.cpp
blob: 88cf8a21f2d0eb01a4f590576f9ebfa2cdc2c4a0 (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);
	}
}