Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
bdc46e27
Commit
bdc46e27
authored
May 12, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline module_Call()
parent
ae5e3537
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
65 deletions
+27
-65
src/modules/modules.c
src/modules/modules.c
+24
-10
src/modules/modules.h
src/modules/modules.h
+2
-2
src/modules/os.c
src/modules/os.c
+1
-53
No files found.
src/modules/modules.c
View file @
bdc46e27
...
...
@@ -1059,21 +1059,35 @@ static module_t * AllocatePlugin( vlc_object_t * p_this, const char *psz_file )
p_module
->
b_loaded
=
true
;
/* Initialize the module: fill p_module, default config */
if
(
module_Call
(
p_this
,
p_module
)
!=
0
)
static
const
char
entry
[]
=
"vlc_entry"
MODULE_SUFFIX
;
/* Try to resolve the symbol */
int
(
*
pf_symbol
)(
module_t
*
p_module
)
=
(
int
(
*
)(
module_t
*
))
module_Lookup
(
p_module
->
handle
,
entry
);
if
(
pf_symbol
==
NULL
)
{
/* We couldn't call module_init() */
free
(
p_module
->
psz_filename
);
module_release
(
p_module
);
module_Unload
(
handle
);
return
NULL
;
msg_Warn
(
p_this
,
"cannot find symbol
\"
%s
\"
in plugin `%s'"
,
entry
,
psz_file
);
goto
error
;
}
else
/* We can now try to call the symbol */
if
(
pf_symbol
(
p_module
)
!=
0
)
{
/* With a well-written module we shouldn't have to print an
* additional error message here, but just make sure. */
msg_Err
(
p_this
,
"cannot initialize plugin `%s'"
,
psz_file
);
goto
error
;
}
DupModule
(
p_module
);
/* Everything worked fine ! The module is ready to be added to the list. */
p_module
->
b_builtin
=
false
;
assert
(
!
p_module
->
b_builtin
);
return
p_module
;
error:
free
(
p_module
->
psz_filename
);
module_release
(
p_module
);
module_Unload
(
handle
);
return
NULL
;
}
/*****************************************************************************
...
...
src/modules/modules.h
View file @
bdc46e27
...
...
@@ -143,8 +143,8 @@ void module_EndBank( vlc_object_t *, bool );
int
vlc_bindtextdomain
(
const
char
*
);
/* Low-level OS-dependent handler */
int
module_Load
(
vlc_object_t
*
,
const
char
*
,
module_handle_t
*
);
int
module_Call
(
vlc_object_t
*
obj
,
module_t
*
);
int
module_Load
(
vlc_object_t
*
,
const
char
*
,
module_handle_t
*
);
void
*
module_Lookup
(
module_handle_t
,
const
char
*
);
void
module_Unload
(
module_handle_t
);
/* Plugins cache */
...
...
src/modules/os.c
View file @
bdc46e27
...
...
@@ -66,62 +66,10 @@
* Local prototypes
*****************************************************************************/
#ifdef HAVE_DYNAMIC_PLUGINS
static
void
*
module_Lookup
(
module_handle_t
,
const
char
*
);
#if defined(HAVE_DL_WINDOWS)
static
char
*
GetWindowsError
(
void
);
#endif
/**
* module Call
*
* Call a symbol given its name and a module structure. The symbol MUST
* refer to a function returning int and taking a module_t* as an argument.
* \param p_module the modules
* \return 0 if it pass and -1 in case of a failure
*/
int
module_Call
(
vlc_object_t
*
obj
,
module_t
*
p_module
)
{
static
const
char
psz_name
[]
=
"vlc_entry"
MODULE_SUFFIX
;
int
(
*
pf_symbol
)
(
module_t
*
p_module
);
/* Try to resolve the symbol */
pf_symbol
=
(
int
(
*
)(
module_t
*
))
module_Lookup
(
p_module
->
handle
,
psz_name
);
if
(
pf_symbol
==
NULL
)
{
#if defined(HAVE_DL_WINDOWS)
char
*
psz_error
=
GetWindowsError
();
msg_Warn
(
obj
,
"cannot find symbol
\"
%s
\"
in file `%s' (%s)"
,
psz_name
,
p_module
->
psz_filename
,
psz_error
);
free
(
psz_error
);
#elif defined(HAVE_DL_DLOPEN)
msg_Warn
(
obj
,
"cannot find symbol
\"
%s
\"
in file `%s' (%s)"
,
psz_name
,
p_module
->
psz_filename
,
dlerror
()
);
#elif defined(HAVE_DL_SHL_LOAD)
msg_Warn
(
obj
,
"cannot find symbol
\"
%s
\"
in file `%s' (%m)"
,
psz_name
,
p_module
->
psz_filename
);
#else
# error "Something is wrong in modules.c"
#endif
return
-
1
;
}
/* We can now try to call the symbol */
if
(
pf_symbol
(
p_module
)
!=
0
)
{
/* With a well-written module we shouldn't have to print an
* additional error message here, but just make sure. */
msg_Err
(
obj
,
"Failed to call symbol
\"
%s
\"
in file `%s'"
,
psz_name
,
p_module
->
psz_filename
);
return
-
1
;
}
/* Everything worked fine, we can return */
return
0
;
}
/**
* Load a dynamically linked library using a system dependent method.
*
...
...
@@ -235,7 +183,7 @@ void module_Unload( module_handle_t handle )
* @param psz_function function name
* @return NULL on error, or the address of the symbol
*/
static
void
*
module_Lookup
(
module_handle_t
handle
,
const
char
*
psz_function
)
void
*
module_Lookup
(
module_handle_t
handle
,
const
char
*
psz_function
)
{
#if defined(HAVE_DL_WINDOWS) && defined(UNDER_CE)
wchar_t
wide
[
strlen
(
psz_function
)
+
1
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment