<div dir="ltr">I managed to build it with MSVC after tinkering with the code a little. Did you guys make any progress in making tor a library? It seems like I can directly call functions like handle_getinfo_helper in control.c to control tor.<div>
<br><div><div>//application_main.cpp</div><div>//Application that starts tor in a new thread in the same process</div><div>#include <future></div><div>#include <iostream></div><div>#include "libtor.h"</div>
<div>using namespace std;</div><div>int main(int argc, char *argv[]){</div><div><span class="" style="white-space:pre"> </span>auto tor_return=async(launch::async,start_tor_main,argc, argv);</div><div><span class="" style="white-space:pre">    </span>while (tor_return.wait_for(chrono::seconds(2))!=future_status::ready){</div>
<div><span class="" style="white-space:pre">            </span>char *ans;</div><div><span class="" style="white-space:pre">         </span>const char *errmsg;</div><div><span class="" style="white-space:pre">                </span>handle_getinfo_helper(NULL, "config/names", &ans, &errmsg);</div>
<div><span class="" style="white-space:pre">            </span>cout<<"application is running! ["<<ans<<"]"<<endl;</div><div><span class="" style="white-space:pre">     </span>}</div><div><span class="" style="white-space:pre">  </span>return tor_return.get();</div>
<div>}</div><div><br></div><div><div>//libtor.h</div><div>//Duplicates the definitions in Tor. If there is a way around this, do tell! :)</div><div>extern "C"{</div><div><span class="" style="white-space:pre">     </span>int<span class="" style="white-space:pre">       </span>start_tor_main(int argc, char *argv[]);//Tor's main() is renamed to start_tor_main</div>
<div><span class="" style="white-space:pre">    </span>int</div><div><span class="" style="white-space:pre">                </span>handle_getinfo_helper(void *control_conn,</div><div><span class="" style="white-space:pre">          </span>const char *question, char **answer,</div>
<div><span class="" style="white-space:pre">            </span>const char **err_out);</div><div>}</div></div><div><br></div><div style>It seems like handle_getinfo_helper is called asynchronously by tor whenever a GETINFO is recieved on the control port so I don't need locking/synchronization. Can someone confirm this? </div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 7, 2013 at 4:40 AM, Gisle Vanem <span dir="ltr"><<a href="mailto:gvanem@broadpark.no" target="_blank">gvanem@broadpark.no</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

I didn't read the original messege on this, but you have problem building Tor and it's libs using MSVC? If so,<br>
you could try my "GNU make" based system for MingW +<br>
MSVC here:<br>
 <a href="http://home.broadpark.no/~gvanem/misc/#tor" target="_blank">http://home.broadpark.no/~<u></u>gvanem/misc/#tor</a><br>
 <a href="http://home.broadpark.no/~gvanem/misc/tor-windows.zip" target="_blank">http://home.broadpark.no/~<u></u>gvanem/misc/tor-windows.zip</a><br>
<br>
I just tested it with today's Tor Git-repo. And it works for me.<span class=""><font color="#888888"><br>
<br>
--gv<br>
</font></span></blockquote></div><br></div></div></div></div>