You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you think you could ever add dll support to this? That would make it soooo more useful.
Something like was in jswin would be nice. Wish that had of kept on being updated.
The text was updated successfully, but these errors were encountered:
It's an interesting idea and could be added. It shouldn't be a lot of work to add the jswin DLL loading code as an API to windowjs.
What kind of usage do you have in mind?
Making this work correctly in the Javascript environment is not trivial though. Some issues that come to mind:
Memory passed into and out of native functions. The Javascript VM and windowjs have no way to know if memory passed to a native function is retained internally or not by the native code, so proper GC for that becomes harder. It could make the assumption that native never retains memory, so the .js code MUST keep a reference if it needs to be kept in memory.
Structs. The .js code would have to pack the content of structs into ArrayBuffers. This depends a lot on the sizes of native types like size_t, int, etc and there's also issues of struct padding and alignment; getting all of that right may work in a given platform but not on others, or on other CPUs, or on other versions of the DLL.
Threading. The Javascript VM MUST execute in a single thread, but DLL code might take callbacks and invoke them in other threads.
Callbacks to native is another issue... we could always pass a trampoline function, but we have no way of knowing the parameters that have been passed and how to wrap that to Javascript properly.
Any mistakes in function signatures, etc in Javascript will seriously mess up the VM and the heap. At best you get a crash; in most cases you might just get wrong parameter values and corrupted heap memory.
So this could be implemented in a robust way for a limited range of native functions that could be invoked in the DLL, but some other usages would be much harder to get right.
Do you think you could ever add dll support to this? That would make it soooo more useful.
Something like was in jswin would be nice. Wish that had of kept on being updated.
The text was updated successfully, but these errors were encountered: