<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 31, 2014 at 5:48 PM, J Decker <span dir="ltr"><<a href="mailto:d3ck0r@gmail.com" target="_blank">d3ck0r@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div>really nothing at all to do with cmake; a couple macros and you can support cross-platform... a few less and you can init interfaces pretty easily....<div>at the end of init or during early discovery of functions, if they fail you can fillthe interface with static methods or return a different interface....</div><div><br></div><div>code part of <a href="https://code.google.com/p/c-system-abstraction-component-gui/source/browse/src/streamlib/ffmpeg/ffmpeg_interface.c" target="_blank">https://code.google.com/p/c-system-abstraction-component-gui/source/browse/src/streamlib/ffmpeg/ffmpeg_interface.c</a><br><div><br></div><div><br></div><div><table style="border-collapse:collapse;padding:0px;margin:0px;color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><tbody style="padding:0px;margin:0px"><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#ifdef WIN32<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top"></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#define lib_format WIDE("avformat-56.dll")<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top"></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#else<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top"><br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#if defined( __ANDROID__) || defined( __LINUX__ )<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top"></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#define lib_format WIDE("libavformat.so")<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top"></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#endif</td></tr></tbody></table></div><div><br></div><div><table style="border-collapse:collapse;padding:0px;margin:0px;color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><tbody style="padding:0px;margin:0px"><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">static struct fmpeg_interface<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">{<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#define declare_func(a,b,c) a (CPROC *b) c<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">#define setup_func(lib, a,b,c) if( ffmpeg.b=(a(CPROC*)c)LoadFunction( lib, _WIDE(#b) ) )<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top"><br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">    declare_func( void, av_register_all,(void) );<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top"> declare_func( int, avformat_open_input, (AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options) );<br></td></tr><tr style="padding:0px;margin:0px"></tr></tbody></table>/*...*/</div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">} ffmpeg;</span><br></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">void Init( void )</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">{</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">    </span><table style="border-collapse:collapse;padding:0px;margin:0px;color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><tbody style="padding:0px;margin:0px"><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">     setup_func( lib_format, void, av_register_all,(void) );<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">       setup_func( lib_format, int, avformat_open_input, (AVFormatContext **, const char *, AVInputFormat *, AVDictionary **) );<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">     setup_func( lib_format, int, avformat_close_input, (AVFormatContext **) );<br></td></tr><tr style="padding:0px;margin:0px"><td style="padding:0px 0px 0px 4px;vertical-align:top">    </td></tr></tbody></table><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">
}</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">void LaterUsage( void )</span></div></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">{</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">    ffmpeg.av_register_all();</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">}</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">void LaterUsageAsPointer( void )</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">{</span></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:12px;white-space:pre-wrap">         struct fmpeg_interface interface = &ffmpeg; /* or from some other function */</span><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">    interface->av_register_all();</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">}</span></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap"><br></span></div></div><div><span style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;white-space:pre-wrap">if you have intellisense, makes for nice popups of available methods.</span></div></div><br></blockquote></div><br></div><div class="gmail_extra">Thanks. After a little Googling, I found this Dr. Dobbs article that describes, with source code, how create a plugin architecture.<br><br></div><div class="gmail_extra">Aaron<br></div><div class="gmail_extra"><br></div></div>