On Sun, Aug 16, 2009 at 6:18 AM, husam <[email protected]> wrote:
> Handle<Value> setup()
> {
> HandleScope handle_scope; <========== The code seems to crash
> here
i've had many, many cases of handlescope crashing, both in DLLs and out, and
when i see an unexpected crash in v8, the first thing i do is comment out
the nearest handlescope... normally that works (for reasons i don't
understand).
I have been using this king for code for my application to add
> extensions and it allows work.
It might work, but the results are (according to the C++ standard) undefined
if your setup_t is a function pointer. While the practice is common in
plugin frameworks, calling the result of a (void*)-to-(function*) is
undefined and is to be avoided if you want to write portable code. There are
ways around this, and in fact i wrote an article about this topic a few
years ago:
http://wanderinghorse.net/computing/papers/#classloading_cpp
that approach is "cast-clean" - it needs no casting at all. i've used that
approach in a number of projects, and have always been very happy with it
(and in general i can sleep better every night if i know i have not cast any
types on that day). In case this is interesting for you, here's my v8 plugin
loader, based on the architecture described in the above article:
http://code.google.com/p/v8-juice/source/browse/trunk/src/include/v8/juice/plugin.h
there are lots of API docs there explaining how the classloader works. In
particular, see the LoadPluginScope class.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---