<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;"><div><div>HI Manolis. &nbsp;If I understand correctly, you are having trouble b/c your plugin B is composed of multiple .c / .cpp files. &nbsp;Yes? &nbsp;I think that isn&#8217;t something we considered. &nbsp;So, yes, a bug of sorts. &nbsp;</div><div><br></div><div>We tend to write small plugins or are content to have the code all squished into a single file. &nbsp;And then we compose the plugins. &nbsp; For instance, the tainted_instructions plugin is very small. &nbsp;And useless on its own (since nothing ever gets labeled). &nbsp;But paired with file_taint or tstringsearch + string search, it can do something. &nbsp; One solution would be to conceive of your analysis as distributed across a few plugins. &nbsp;</div><div><br></div><div>Or I think it would all work if you just sure that that code that needs the other plugin&#8217;s functionality is limited to one source file in your plugin.</div><div>&nbsp;&nbsp;</div><div>Ok, this makes it sound like we <span style="font-weight: bold;">designed</span>&nbsp;things this way. &nbsp;That&#8217;s not true. &nbsp;I, at least, was aware of this issue/limitation but didn&#8217;t consider it worth the extra software engineering. &nbsp;So, yes, we are lazy and prefer using PANDA to software engineering it. &nbsp;Sorry!</div><div><br></div><div>I don&#8217;t have a solution ready at hand for your problem, but we will think about it. &nbsp;You got any ideas that aren&#8217;t too ugly or painful?</div><div><br></div><div><div>--</div><div>Tim Leek</div><div>Technical Staff</div><div>Cyber System Assessments</div><div>MIT Lincoln Laboratory</div><div>781-981-2975</div><div><br></div></div></div><div><br></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> Manolis Stamatogiannakis &lt;<a href="mailto:mstamat@gmail.com">mstamat@gmail.com</a>&gt;<br><span style="font-weight:bold">Date: </span> Sunday, April 19, 2015 at 7:19 PM<br><span style="font-weight:bold">To: </span> "<a href="mailto:panda-users@mit.edu">panda-users@mit.edu</a>" &lt;<a href="mailto:panda-users@mit.edu">panda-users@mit.edu</a>&gt;<br><span style="font-weight:bold">Subject: </span> Re: [panda-users] problems with plugin api calls<br></div><div><br></div><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div><div dir="ltr"><div>Ok, this looks like a bug in the way the plugin calls are implemented.<br><br></div>
In pluginA_ext.h, the symbol used to point to the api call is defined as:<br>
static api_call_t __api_call = NULL;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><div><div><div><br></div><div>Because the symbol is static, it will be re-defined within *every* module that includes pluginA_ext.h.<br></div><div>However, in the example I described only the symbol in pluginB.cpp will be initialized.<br></div><div>The symbol in pluginB_module.cpp will remain NULL.<br><br></div><div>Could someone propose some clean way around this limitation?<br><br></div><div>I quickly checked that if I change the definition in the _ext header to an "extern" declaration and move the definition in pluginB.cpp the calls succeed. But this is just a quick&amp;dirty hack to verify the problem, as it involves manually editing the _ext
 file.<br><br></div><div>Thanks,<br></div><div>Manolis<br></div><div><br></div><div><br></div><div><br><br><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-19 15:56 GMT-07:00 Manolis Stamatogiannakis <span dir="ltr">
&lt;<a href="mailto:mstamat@gmail.com" target="_blank">mstamat@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div>I'm having problems with using the plugin api to make calls across plugins. Is there an implicit assumption that plugins should consist of a single file?<br><br></div>
Here are the steps I make:<br></div>
(1) define the function in pluginA_int_fns.h<br></div>
(2) include this header in pluginA_int.h<br>
(3) implement the function in pluginA.cpp<br></div>
&nbsp;<br></div>
(4) include generated pluginA_ext.h from pluginB.cpp<br></div>
(5) call init_pluginA_api() without problems<br></div>
(6) include generated pluginA_ext.h from pluginB_module.cpp<br></div>
(7) make the API call from within pluginB_module.cpp<br><br></div>
Everything compiles fine, but at runtime I hit the assertion error in the function definition in pluginA_ext.h.<br></div>
I added some printfs and __api_call is not NULL just after init_pluginA_api() in pluginB.cpp. However, it is NULL inside pluginB_module.cpp.<br><br></div>
Any ideas how could that happen? Am I missing something in the picture?<br><br></div>
Thanks,<br></div>
Manolis<br><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><br></div></div></div></span></body></html>