Topic: APLX Help : Interfacing to other languages : Overview of interfacing to other languages
[Next | Contents | Index | APL Home ]

Overview of interfacing to other languages

Interfacing to .Net, Java, and other object-oriented software

APLX allows you to use classes written in modern object-oriented languages such as the .Net languages (C#, Visual Basic, and other languages which generate code for the .Net Common Language Runtime), Java, and Ruby, and also the R statistical language. You can create and use instances of external classes, call 'static' (shared) methods, and in some cases evaluate statements in the external language directly. See the next section on Using External Classes for full details.

Interfacing to procedural languages and shared libraries

APLX includes two main facilities for calling external procedural (i.e. not object-oriented) code from within APL, for example operating-system libraries (DLLs) or code written in C. These are:

  • The ⎕NA system function, which allows you to define 'external functions' (i.e. calls to shared libraries or DLLs) and call them directly from APL
  • The Auxiliary Processor (shared variable) mechanism, which allows you to interface to custom code written in C or other low-level languages. The details of writing an Auxiliary Processor are discussed in a later section. See the ⎕SVO system function for more information on using auxiliary processors

The choice between these two mechanisms depends on what you are trying to do. To interface to an existing shared library or DLL, or to call the operating system directly, ⎕NA is usually the better choice. To write a full-featured sub-system which provides extensive functionality to APLX, the auxiliary processor mechanism may be preferred.

Interfacing via OLE and OCX (Windows only)

Under Windows, Microsoft provide a generalized means for interfacing to external applications and using external controls. This mechamism is variously known as OLE, OCX, ActiveX, and COM. Although to some extent it has been superseded by the .Net architecture, it remains important because it is supported by a wide range of software. There are three ways in which you can use this feature:

(a) You can place external OCX or ActiveX controls directly on your APLX user-interface windows. For example, you can use an Adobe® AcrobatTM control as though it were a built-in APLX control. This is done simply by creating a window and then creating an external control on it.

(b) You can embed OLE (Object Linking and Embedding) documents in your windows. For example, you could include a Microsoft Word document as part of a more complex window, merging the Word menus and toolbar with your own. To allow this, APLX includes a control called an 'OLEContainer' which you place on your window. You can then specify the document to be embedded or linked, or allow the user to select one.

(c) You can invoke and exchange data and commands with external OLE Server Applications. This is somewhat similar to (b), but the application runs independently of APLX and is not embedded in one of your windows. For example, you could invoke Excel, cause it to load a spreadsheet, and extract the data from the spreadsheet as an APL nested array, without the user being involved.

See the section on OCX/ActiveX Controls and OLE Automation in the separate manual APLX System Classes and User-Interface Programming for full details.

Topic: APLX Help : Interfacing to other languages : Overview of interfacing to other languages
[Next | Contents | Index | APL Home ]