What is in WinReg?

Bear in mind that the top level Raku program is compiled into memory and run. But the default for any Module is that it is compiled first, and the compiled version is stored. (You can prevent precompilation by using the statement "no precompilation;" which can be useful if you want to have trace statements. But don't forget to take out the 'no precompilation' once development has finished.)

So the Raku compiler finds all the 'use' statements, and looks for an already compiled version of some module (lets call it Module) - the 'precompilation'. (Have you noticed any .precomp/ directories in the directory you run the program from?) There is a reason for this, but it's a bit long to explain here.

If a precompiled version cannot be found by Raku, then it will compile the first source of Module and store it in an appropriate place (a local .precomp/ directory if you are developing Module and you haven't installed it). That is why when you run a Raku program for the first time with a big module it takes for ever, but the next time it goes quite  fast.

If there is a 'use' statement in the Module, then Raku will do the same for that module.

What often happened to me was that I developed a module and I had a "use lib 'lib';" statement in it. When the module was the top program (so to speak), no errors arise, but when you try to pre-compile that Module, you get an error.

The way around this is to delete the 'use lib ...' pragma. And instead, compile with 'raku -Ilib ...' (or 'perl6 -Ilib'). Note that the option is Capital I not lower l (the font in my email agent doesn't make it easy to see the difference).

This option implies that there is a directory 'lib' local to the directory where the raku compiler is being invoked, and that your module WinReg.pm6 is in 'lib'. Raku then looks FIRST at 'lib' for Module. If it finds a source there, it compiles it and stores it. It then does not look any further for WinReg.pm. For other modules, Raku will then look along the default linked list of directories until it finds a source it can use.

Hope this helps a bit.

Richard

On 16/01/2020 20:15, ToddAndMargo via perl6-users wrote:
On 2020-01-16 11:45, ToddAndMargo via perl6-users wrote:
Hi All,

How do you troubleshoot:

      raku -I. -c WinMessageBox.pm6

      Circular module loading detected trying to
      precompile /home/CDs/Windows/NtUtil/WinReg.pm6

I have traced it down to this:


     use WinReg :to-UTF16-c-str;
or just
     use WinReg;


Comment it out and it checks fine.  I am not calling
any modules imported from WinReg.pm6 at this point.

What is going on?

Yours in confusion,
-T

Does this help?

$ raku -I. --stagestats -c WinMessageBox.pm6
Stage start      :   0.000
Stage parse      : ===SORRY!===
Circular module loading detected trying to precompile /home/CDs/Windows/NtUtil/WinReg.pm6

Reply via email to