Change In Way AEX Files are Used in a Web Application

Description

Describes how to alter an application to work without a5w_load_aex(), which is no longer needed.

A5W_Load_AEX() is no longer needed

AEX files are compiled Xbasic files. They contain Xbasic functions that you have created and want to use in your web application in Xbasic code that you call on your own .a5w pages, or in code that is executed in a server-side event of a component. Previously, your .a5w page typically used the a5w_load_aex function to load the .aex file into memory before you called a function that was defined in it. Then, before your .a5w page terminated, the a5w_unload_aex function was called to unload the .aex file from memory. In the case of a Grid component, the a5_load_aex() function was used automatically if you set the 'AEX Files' property in the Grid definition. Using the a5w_load_aex() function is now no longer recommended because it is not thread-safe. In a busy web application, if two or more users execute an .a5w page that tries to load an .aex file at the same time, the operation could fail, resulting in a function that was defined in an AEX not being available to the calling code. Instead of using the a5w_load_aex() function, you now specify the AEX files used by your application in the new Web Project Properties dialog. To get to this dialog click the 'Project Properties' button on the Web Control Panel. (At this point in time, there is only one property in Web Project Properties, but we will be adding many more in future updates.) The Web Project Properties are published in the a5_application.a5i file. The a5_application.a5i file is created and published automatically every time you publish any files in your project. The AEX files listed in the a5_application.a5i file are loaded into memory when your application starts up and remain in memory until the server is shut down. You do not need to use the a5w_load_aex() or a5w_unload_aex() function on any of your .a5w pages if you have specified the AEX file in your Web Project Properties.

Do I need to Change How My Application Uses .AEX Files?

The a5w_load_aex() function will continue to work. So if you prefer not to update your application to take advantage of the new way of handling .aex files, then you don't have to, even though we recommend that you do. If you do want to change your application, then:

  1. Edit every .a5w page that use the a5w_load_aex() function and a5w_unload_aex() function and simply comment out the calls to a5w_load_aex() and a5w_unload_aex().

  2. Go to the Project Properties dialog from the Web Control Panel and specify the list of AEX files used by your application.

AEX Files are Cached in Memory

If you edit an AEX file and then re-publish it, or you add a new AEX file to the list of AEX files in your Web Project Properties and then re-publish your application, the changes will not be immediately visible because the server caches the AEX files. To force the server to reload the AEX files you must stop and then restart the server. If your application is running on a remote server, then stopping and then re-starting the server may not be practical. In this case you will have to execute an .a5w page that executes the Server.ClearAEXCache() method. For example, you might create an .a5w page in your application called 'ClearAEXCache.a5w' with this code in the page:

<%a5
 Server.ClearAEXCache()
 %>

After you publish any changed AEX files, or changes to the list of AEX files in your project, you would execute the 'ClearAEXCache.a5w' page.