QML.jl icon indicating copy to clipboard operation
QML.jl copied to clipboard

Use of QML in a module

Open Ph0non opened this issue 8 years ago • 2 comments

Startup Time for my code is quite long, so i want to try to pack it all into a module and use __precompile__().

Somehow QML didn't recognize the functions used in julia which are exposed to QML through @qmlfunction. Neither if i export the function or call it with Julia.NuclideVector.decay_gui from QML (still @qmlfunction decay_gui of julia side).

It always results in TypeError: Cannot call method 'decay_gui' of undefined.

Is it even reasonable and possible to precompile a package with the use of QML?

edit: https://github.com/Ph0non/NuclideVector/tree/module

Ph0non avatar Feb 09 '17 08:02 Ph0non

I remember experimenting with precompilation for QML itself, but couldn't get it to work. Putting your own (backend) functions in a precompiled module should work, it could be a macro hygiene issue if it doesn't, I'll take a look.

barche avatar Feb 09 '17 21:02 barche

OK, just looked at this a bit more in detail, and what works is calling precompiled methods as in the test I just committed. However, these methods must be in a separate module that does not depend on QML, since QML itself cannot be precompiled because it uses pointers to functions inside ccall. You should be able to place your callbacks in a submodule and precompile that, so everything can still be in a single package.

barche avatar Feb 10 '17 16:02 barche