Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8fd9a633d077c3a46f6de343767e4b882115d950 (plain) (blame)
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
30
31
32
33
/*
 * (c) Copyright IBM Corp., 2000, 2001
 * All Rights Reserved.
 */

/**
 * library.c
 *
 * This file contains the implementation of the
 * shared libraries functions.
 *
 */

#include <windows.h>

unsigned int OpenLibrary(char *name)
{
	UINT prevMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
	HINSTANCE handle = LoadLibrary ((LPCSTR)name);
	SetErrorMode(prevMode);
	return (unsigned int)handle;
}

unsigned int LibraryLookupName(unsigned int handle, char *name)
{
	if (handle == 0) return 0;
	return (unsigned int)GetProcAddress ((HINSTANCE)handle, (LPCSTR)name);
}

void CloseLibrary(unsigned int handle)
{
	if (handle != 0) FreeLibrary ((HINSTANCE)handle);
}

Back to the top