mpv/DOCS/man
Kacper Michajłow eab3842d8b cplugin: allow loading mpv_* symbols dynamically
Defining MPV_CPLUGIN_DYNAMIC_SYM during plugin compilation will replace mpv_*
functions with function pointers. Those pointer will be initialized when
loading the plugin.

It is recommended to use this symbol table when targeting Windows. The loader
does not have notion of global symbols. Loading cplugin into mpv process will
not allow this plugin to call any of the symbols that may be available in
other modules. Instead cplugin has to link explicitly to specific PE binary,
libmpv-2.dll/mpv.exe or any other binary that may have linked mpv statically.
This limits portability of cplugin as it would need to be compiled separately
for each of target PE binary that includes mpv's symbols. Which in practice
is unrealictis, as we want one cplugin to be loaded without those restrictions.

Instead of linking to any PE binary, we create function pointer for all mpv's
exported symbols. For convinience names of entrypoints are redefined to those
pointer so no changes are required in cplugin source code, except defining
MPV_CPLUGIN_DYNAMIC_SYM. Those function pointer are exported to make them
available for mpv to init with correct values during runtime, before calling
`mpv_open_cplugin`.

Note that those pointer are decorated with `selectany` attribute, so no need
to worry about multiple definitions, linker will keep only single instance.

This fixes cplugin usability on Windows. Without any API changes, only
recompilation with -DMPV_CPLUGIN_DYNAMIC_SYM is needed.
2023-09-20 02:16:45 +00:00
..
af.rst various: remove trailing whitespace 2022-05-14 14:51:34 +00:00
ao.rst ao_pipewire: clarify --pipewire-buffer=native 2023-04-23 21:03:58 -07:00
changes.rst manpage: directly link interface-changes.rst in changelog section 2020-02-21 14:34:02 +01:00
console.rst console.lua: add a script-opt for the border size 2023-04-26 16:30:01 +00:00
encode.rst manpage: explain deprecated usage of multiple items with *-add 2020-01-07 18:13:12 +01:00
input.rst demux: add crop to mp_codec_params 2023-09-17 16:48:42 +00:00
ipc.rst DOCS: Add missing 'not' 2023-01-28 11:59:59 -05:00
javascript.rst lua/js: remove user-data helpers 2023-01-29 01:52:31 +02:00
libmpv.rst cplugin: allow loading mpv_* symbols dynamically 2023-09-20 02:16:45 +00:00
lua.rst DOCS/lua.rst: fix typo 2023-09-09 09:09:52 -04:00
mpv.rst DOCS/mpv: document ZOOMIN & ZOOMOUT multimedia keys 2023-08-23 15:37:02 +02:00
options.rst builtin.conf: modernize internal profiles 2023-09-19 22:26:56 +02:00
osc.rst osc: add scrolling to audio/sub buttons 2023-09-17 00:03:45 +02:00
stats.rst stats.lua: enable --tone-mapping-visualize while stats shown 2023-08-30 17:10:13 +02:00
vf.rst f_lavfi: don't reject dynamic lavfi ins/outs 2023-08-28 00:29:43 +02:00
vo.rst DOCS/vo: remove outdated reference to --vo-vaapi-deinit-mode 2023-09-17 15:24:55 -05:00