User Extensions/Externals

Paul D. DeRocco pderocco at
Wed Apr 28 01:02:03 EDT 2010

> From: Graham & Heather Harrison
> Does this mean that using an external is not just a case of
> putting it in the appropriate library and Voila!? In that case I
> will have to look at these lessons…

I don't know what the instructions you followed said, but you need to bind
the external to your app by setting the "externals" property of a stack to
the path to the DLL or bundle. It's possible to set the property of the main
stack manually, and then save the app; when you restart the app, it will
load the external. However, for cross-platform apps the external name will
be different (foo.dll versus foo.bundle), so you have to do something a bit
uglier, typically with some code in the preOpenStack handler of your main

    if "ExternalWrapper" is not among the lines of the stacksInUse then
      set the name of the templateStack to "ExternalWrapper"
      if the platform is "Win32" then
        set the externals of the templateStack to "externals/foo.dll"
        set the externals of the templateStack to "externals/foo.bundle"
      end if
      set the visible of the templateStack to false
      create stack
      start using stack "ExternalWrapper"
    end if

This causes the name to be determined at runtime, but by then the main stack
is already loaded so you have to attach the external to a separate dummy
stack. You should also delete the dummy stack in your main stack's
closeStack handler.

At least this is how it's done in 3.5. I don't have 4.0.


Ciao,               Paul D. DeRocco
Paul                mailto:pderocco at

More information about the Use-livecode mailing list