Does using ccall(...) in a module prevent its precompilation?

#1

I’m getting constant warnings for one module among many:

┌ Warning: Module my_module_1 with build ID 54547777901434 is missing from the cache.
│ This may mean my_module_1 [top-level] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:941

and the only difference I can think of between that module and the others is that it is the only one which uses ccall(…) to call an external system library. Does using ccall(…) in a module prevent its precompilation? Or is it possibly because the ccall(…) passes a Ref(…) on non-constant program data?

0 Likes

#2

No, ccall should be compiled down to a native call. Can you try disabling precompilation (__precompile__(false)) and making sure your code works and passes any tests you might have?

0 Likes

#3

No, I’ve certainly used ccall within precompiled modules without issue. Note, however, that using ccall to, for example, initialize a pointer may not be safe during precompilation, since that pointer will not be valid later. But even that wouldn’t cause the issue you’re seeing. Can you provide a minimal example that demonstrates the problem?

0 Likes