Hello World Application

NetAlive has broad computer-language support for the professional programmer. NetAlive can automate the client, server, or peer using compiled or interpreted languages. Compiled languages may be distributed via source code and compiled on-the-fly or can be distributed in binary. Languages may produce programs or dynamically-loaded libraries (DLLs). The language mechanism is field-extensible, but at this time includes C, C++, Perl, MS-DOS Batch, Norton Batch Runner, Lex, Java, and (16- and 32-bit) Visual C++ projects. Support for Visual C++ implies a link to the Visual C++ development environment. A security mechanism protects against penetration by hackers.

This example shows how to create functional tasks in various languages. The example runs "hello world" tasks coded and captures their output.

Step 1: Hello World in DOS Batch

    echo Hello world>$3
    rem $9

The screen should appear as shown:

Discussion: Setting the source language to "Batch" makes NetAlive interpret the source code as a DOS batch file. The source code may contain formal parameters of the form $nn. Before interpretation, NetAlive replaces the parameters with the name of a temporary file.

NetAlive performs a rudimentary check to ensure the validity of connections. Generally, a function should reference a formal parameter if and only if there is an arrow to or from that position on the task. In the example, $3 and $9 appear in the source code because the Batch task has connections at these positions.

Step 2: A Compiled Language

Compiled languages look similar but operate differently.

    #include <stdio.h> //argv[9]
    main(int argc, char **argv) {
        FILE *o = fopen(argv[3], "w");
        fprintf(o, "Hello world\n");

Discussion: NetAlive compiles source code for languages. Essentially, NetAlive knows how to invoke a compiler for a particular language. It also maintains a cache of compiled tasks so it does not have to run a compiler any more often than necessary.

NetAlive tasks can be made portable. NetAlive compiles each task on the computer that executes it (except for "security server" -- see below). To make a portable task, the developer must use a language for which compilers are available for all target computer and must put portable source code in the task. (NetAlive can manage code distribution and heterogeneous compilation, but it does not help make code portable.)

NetAlive communicates with C-style tasks via temporary file names passed on the command line. NetAlive places something in each of argument positions 1-12. Unconnected positions receive a dash "-." They get the name of a temporary file containing the parameter is they are.

NetAlive's rudimentary check requires that the source code contain the sequence argv[nn] if and only if there is an arrow to or from that position on the task. In the example, argv[3] and argv[9] appear because there are connections at these positions.

Step 3: A Subroutine Linkage

    #include <windows.h>		
    #include <string.h>	
    extern "C" {	
    int FAR PASCAL LibMain(HANDLE, WORD,			
            WORD, LPSTR) {		
    return 1;	
    struct NetAliveIOData {		
        LPSTR ptr;		
        long len;	
    int CALLBACK __export NetAlive(int argc,			
            struct NetAliveIOData *argv,			
            LPSTR (CALLBACK __export				
            *AllocCallback)(long)) { // argv[9]		
        argv[3].ptr = (*AllocCallback)				
                (argv[3].len = 13);		
        strncpy(argv[3].ptr, "Hello world\r\n", 13);		
        return 0;	

Discussion: This subroutine-level linkage bears close resemblance to a C-program's "main(argc, argv)" linkage. The difference is that the argv vector is a list of data structures containing a memory pointer and length. The data that would be in a file therefore passes in memory. The subroutine uses argument AllocCallback to allocate memory.

NetAlive documentation describes several other subroutine linkages that differ primarily on portability features.

Compilation and Embedded Binaries

NetAlive can store both source and binary code in an application. NetAlive has a command that adds binary for all tasks containing a compilable language. This makes the application runnable on computers without a compiler. Another command adds binary and deletes source. This additionally secures the application against disclosure of source code.

The Language Definition File

Information about specific programming languages comes from a language definition file. The NetAlive system has a single, but parameterized, algorithm that handles all compilation, interpretation, and execution of functional tasks. The language definition file matches the language name against language attributes, compiler file names, etc.

For example, the language definition for "Perl" appears below:

    CkP=//Secure Perl interpreter//	

The meaning of each field appears below:

Language Enabling and Security

NetAlive addresses a broad range of security and configuration considerations by letting each language go into one of four enabling or security states. The proper setting for each language depends on the availability of a local compiler and the amount of security desired.

Integrated Development Environment (IDE)

A NetAlive task can also contain an Integrated Development Environment project (Visual C++ only in NetAlive version 0.0.3). NetAlive actually maintains source code as a list of ASCII or binary data blocks. The source code for an IDE project consists of all the source files for the project (i. e. normal source code, graphical resources, and a makefile). NetAlive typically compiles the project by invoking a "make" command.

NetAlive lets the user edit the source code list either directly or via link to the IDE. Specifically, arrow keys "<-" and "->" move back and forth along the source list. The "quick edit" button lets the user edit the selected source module using a built-in text editor. The "native edit" button transfers the files to disk and invokes the IDE's editor.

Currently Supported Languages

Completing the Application

The screen shows the complete NetAlive "hello world" application.

[Up][NetAlive Home Page]