[Haskell-cafe] Need help with very simple C++ FFI call
carter.schonwald at gmail.com
Tue Nov 19 17:15:24 UTC 2013
There's a flag you can pass to ghci for that thread local issue. I forget
what it is, but it should be in the manual.
On Tuesday, November 19, 2013, Thiago Padilha wrote:
> > Ok, then I don't see anything obviously wrong.
> > I was embeding v8 into haskell project few months ago, and almost the
> > same code works for me.
> > I don't have v8 installed right now, so I can't try your code at the
> > moment, but I see only one not trivial difference with my code. I'm
> > creating isolate manually, and you are using the default one. Check that
> > Isolate::GetCurrent() returns anything. I can imaging that your code is
> > running in unbound green thread, or it is bound to OS thread other then
> > the main one. v8 use thread local storage, that can be the issue.
> Yuras, you are correct now :)
> I've replaced the first line by these:
> Isolate* isolate = Isolate::New();
> // Sets this isolate as the entered one for the current thread
> And the example worked as expected. Thanks for this very useful tip.
> I still dont understand why ghci is not using the default thread to
> run the binding, but from now on I will be more alert when binding to
> libraries that uses threads.
> Theres something else I also dont understood about FFI: When trying to
> debug the problem I've written many printf statements but none of
> them showed on the screen, but now that the example is working I've
> notice that all printed text appears once I exit ghci. Why is that
> Haskell-Cafe mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe