qt: playlist: use item title if available
[vlc.git] / src / os2 / plugin.c
blob21c621746e5856e4c302e6ff910117aea67f9349
1 /*****************************************************************************
2 * plugin.c : Low-level dynamic library handling
3 *****************************************************************************
4 * Copyright (C) 2001-2007 VLC authors and VideoLAN
5 * Copyright (C) 2012 KO Myung-Hun
7 * Authors: Sam Hocevar <sam@zoy.org>
8 * Ethan C. Baldridge <BaldridgeE@cadmus.com>
9 * Hans-Peter Jansen <hpj@urpla.net>
10 * Gildas Bazin <gbazin@videolan.org>
11 * KO Myung-Hun <komh@chollian.net>
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU Lesser General Public License as published by
15 * the Free Software Foundation; either version 2.1 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
32 #include <string.h>
33 #include <sys/types.h>
34 #include <dlfcn.h>
36 #include <vlc_common.h>
37 #include <vlc_charset.h>
38 #include "modules/modules.h"
40 void *vlc_dlopen(const char *psz_file, bool lazy )
42 const int flags = lazy ? RTLD_LAZY : RTLD_NOW;
43 char *path = ToLocaleDup( psz_file );
44 if (unlikely(path == NULL))
45 return NULL;
47 void *handle = dlopen( path, flags );
48 free( path );
49 return handle;
52 int vlc_dlclose(void *handle)
54 return dlclose( handle );
57 void *vlc_dlsym(void *handle, const char *psz_function)
59 char buf[strlen(psz_function) + 2];
60 buf[0] = '_';
61 strcpy(buf + 1, psz_function);
62 return dlsym( handle, buf );
65 char *vlc_dlerror(void)
67 const char *errmsg = dlerror();
68 return (errmsg != NULL) ? FromLocaleDup(errmsg) : NULL;