Mangled Exports When Compiling Plugin With MSVC
Ran into an issue trying to compile a plugin using Microsoft Visual Studio 2015. The plugin was unable to be discovered even though it was in the GST_PLUGIN_ROOT.
I tracked it down to mangled exports. Here is the output of dumpbin for the dll
Dump of file myplugin.dll
File Type: DLL
Section contains the following exports for myplugin.dll
00000000 characteristics
5CDB6D94 time date stamp Tue May 14 21:38:28 2019
0.00 version
1 ordinal base
2 number of functions
2 number of names
ordinal hint RVA name
1 0 00011582 ?gst_plugin_myplugin_get_desc@@YAPEBU_GstPluginDesc@@XZ = @ILT+1405(?gst_plugin_myplugin_get_desc@@YAPEBU_GstPluginDesc@@XZ)
2 1 00011456 ?gst_plugin_myplugin_register@@YAXXZ = @ILT+1105(?gst_plugin_myplugin_register@@YAXXZ)
To work around the issue I added extern "C"
to the GST_PLUGIN_DEFINE
extern "C" GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
myplugin,
"My Plugin",
plugin_init, VERSION, "Proprietary", "gst-my-plugin",
"https://www.example.com")
According to @slomo this shouldn't be necessary. Please let me know if there is anything else I can provide.