1 /** \file   dynlib-win32.c
2  * \brief   Win32 support for dynamic library loading
3  *
4  * \author  Christian Vogelgsang <chris@vogelgsang.org>
5  */
6 
7 /*
8  * This file is part of VICE, the Versatile Commodore Emulator.
9  * See README for copyright notice.
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24  *  02111-1307  USA.
25  *
26  */
27 
28 #include <windows.h>
29 
30 #include "dynlib.h"
31 
vice_dynlib_open(const char * name)32 void *vice_dynlib_open(const char *name)
33 {
34     return LoadLibrary(name);
35 }
36 
vice_dynlib_symbol(void * handle,const char * name)37 void *vice_dynlib_symbol(void *handle,const char *name)
38 {
39     return GetProcAddress((HMODULE)handle, name);
40 }
41 
vice_dynlib_error(void)42 char *vice_dynlib_error(void)
43 {
44     return "unknown";
45 }
46 
vice_dynlib_close(void * handle)47 int vice_dynlib_close(void *handle)
48 {
49     if (FreeLibrary(handle)) {
50         return 0;
51     } else {
52         return -1;
53     }
54 }
55