OLView060410

The OpenLaszlo <view>

June, 2010

Dear Q,

I have a large application and am looking for a way to speed up the compile time. Can you help?

- Mr. Speedy

________________________________________________________________________________

Dear Mr. Speedy,
Then the "lzo" library feature is for you! LZO stands for "LasZlo Object" file format.

For awhile, the 'lzc' compiler has been able to compile
files into ".lzo" binary files by using the "-c" flag. It stored the
library code in an intermediate platform-independent format.

In the latest release the compiler can also store precompiled
platform-specific object code for both the DHTML and SWF10 runtime in
the library, so that linking an application with libraries should be
faster than ever.



To compile a library to include native object code for both runtimes,
you call lzc as follows, specifying one or more runtimes to place in
the library.

  lzc -c --runtime=swf10,dhtml mylibrary.lzx

LZO libraries which reference other external LZO libraries

We have a new rule, which is that when you compile a library that
makes any external references to classes or globals in another
library, that library must be already compiled down to an external
binary library lzo file, and one which contains the target
runtime.

For example let's say you are an ice-cream manufacturer, and have some
new equipment that makes ice-cream bars. Your machine came with some
software from the factory which makes basic tubs of icecream, and then
you extend that software with your own custom class to make ice-cream
bars.

Let's say the manufacturer supplied an lzx file to be included when
you compile, called "extdessert.lzx" that defines a base "icecream"
class. It's source code might be:

extdessert.lzx:
  <library>
      <class name="icecream">
        ...
      </class>
  </library>

Then your code might look like:

libdir/mylib.lzx:
  <library>
    <include href="../extdessert.lzx"/>
    <class name="icreambar" extends="icecream">
        <attribute name="coating" type="string" value="chocolate"/>
        <attribute name="icecreamflavor" type="string" value="vanilla"/>
        ....
     </class>
   </library>

Now you want to go to compile your code into a library.

If we want to compile to swf10, the "extdessert" file MUST be first
compiled to an lzo which contains a swf10 runtime target , or the

flash10 compiler will not be able to link against it properly when you
build your library.

So you would in that case first build the "extdessert.lzx" into an lzo

   lzc -c --runtime=swf10 extdessert.lzx

and then your custom class library can be linked against it

   lzc -c --runtime=swf10 libdir/mylib.lzx

So basically the rule is that when building a lzo library that depends
on extending or referencing classes from other files, those files MUST
be compiled to swf10 lzo's first.

Your Partner in Speed,

Q