On Sat, Jun 25, 2011 at 9:02 PM, Stephan Beal <[email protected]> wrote:

> On Sat, Jun 25, 2011 at 6:53 PM, Louis Santillan <[email protected]>wrote:
>
>> This sounds perfect for dynamically binding dlopen/dlsym functions.
>> Run tests on those types of functions?  Any luck?
>>
>
> i haven't done that this this API because a primary design goal is to stay
> 100% header-only. The code which this code originally derived from makes
> heavy use of dlopen (but doesn't use dlsym) for plugins:
>

Actually... it just occurred to me:

v8::InvocationCallback dlOpen =
  v8::convert::FunctionToInCa< void * (char const *, int), ::dlopen>::Call;

that would _almost_ work, but we cannot convert (void *) to JS this way, so
we would need a very thin wrapper around it or we would need to ignore the
return value when binding, which we can do like this:

v8::InvocationCallback dlOpen =
  v8::convert::FunctionToInCaVoid< void * (char const *, int),
::dlopen>::Call;

that would actually compile and be enough to implement the plugin model i
already use: we simply open DLLs and lets the C++ static initialization
perform the actual plugin registration. We never look at the DLL symbols at
all. Since calling dlclose() actually results in crashes in many cases (i
have a lot to say about why one should Never call call dlclose(), but it's
summarized on the wiki link i posted in my last response), we can safely
ignore the return value of dlopen() for this particular use case.

Thanks for the idea!

:-D

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to