= Legacy applications = A '''legacy application''' is one for which an executable is available, but not the source code. Therefore it cannot use the BOINC API and runtime system. However, such applications can be run using BOINC. Here's an example: * Compile the program 'worker' from the [http://boinc.berkeley.edu/example.php boinc_samples] tree, producing (say) 'worker_5.10_windows_intelx86.exe'. This is the legacy app. If reads from stdin and writes to stdout; it also opens and reads a file 'in', and opens and writes a file 'out'. It takes one command-line argument: the number of CPU seconds to use. * Compile the program 'wrapper' from the [http://boinc.berkeley.edu/example.php boinc_samples] tree, producing (say) 'wrapper_5.10_windows_intelx86.exe'. This program executes your legacy application, and acts as a proxy for it (to report CPU time etc.). * [http://boinc.berkeley.edu/app.php Create an application] named 'worker', and a corresponding directory 'project/apps/worker'. In this directory, create a directory 'wrapper_5.10_windows_intelx86.exe'. Put the files 'wrapper_5.10_windows_intelx86.exe', and 'worker_5.10_windows_intelx86.exe' there. * In the same directory, create a file 'job.xml=job_1.12.xml' (1.12 is a version number) containing {{{ worker_5.10_windows_intelx86.exe stdin stdout [ stderr ] [ 10 ] }}} This file is read by 'wrapper'; it tells it the name of the legacy program, what files to connect to its stdin/stdout, and a command-line argument. * Create a workunit template file {{{ 0 1 0 in 1 stdin 1000000000000 1000000000000 }}} and a result template file {{{ 5000000 5000000 out stdout }}} Note that the files opened directly by the legacy program must have the tag. * Run [http://boinc.berkeley.edu/tool_update_versions.php update_versions] to create an app version. * Run a script like {{{ cp download/input `bin/dir_hier_path input` cp download/input2 `bin/dir_hier_path input2` bin/create_work -appname worker -wu_name worker_nodelete \ -wu_template templates/worker_wu \ -result_template templates/worker_result \ input input2 }}} to generate a workunit. == Notes: == * This requires version 5.5 or higher of the BOINC core client. * Multiple tasks per job is not implemented yet. Future versions of wrapper may allow you to run multiple applications in sequence (as specified in the job.xml file). * TODO: provide a way for projects to supply an animated GIF which is shown (with user/team credit text) as screensaver graphics. * If the wrapper itself has command-line arguments (e.g., specified in the workunit template) these are passed to the application, after those specified in the job file. To understand how all this works: at the beginning of execution, the file layout is: ||'''Project directory'''||'''slot directory'''|| ||job_1.12.xml||in (copy of project/input)|| ||input||job.xml (link to project/job_1.12.xml)|| ||input2||stdin (link to project/input2)|| ||worker_5.10_windows_intelx86.exe||stdout (link to project/worker_nodelete_0)|| ||wrapper_5.10_windows_intelx86.exe||worker_5.10_windows_intelx86.exe (link to project/worker_5.10_windows_intelx86.exe) || ||wrapper_5.10_windows_intelx86.exe (link to project/wrapper_5.10_windows_intelx86.exe) || The wrapper program executes the worker, connecting its stdin to project/input2 and its stdout to project/worker_nodelete_0. The worker program opens 'in' for reading and 'out' for writing. When the worker program finishes, the wrapper sees this and exits. Then the the BOINC core client copies slot/out to project/worker_nodelete_1.