|
The server runs as a separate thread to allow the user interface to operate independently, and all of its functionality can be accessed from host C++ programs. The information you need to achieve this can be found in the following folders:
|
<3L>Diamond\Server\Include\
|
header files for server access
|
|
<3L>Diamond\Server\Examples\TIS\
|
sample DOS application.
|
|
<3L>Diamond\Server\Examples\WinApp\
|
sample Windows application
|
The interface to the server is in the library Serve3L.dll and this can be accessed as follows:
#include "Serve3L.h"
CServe3L *GetServer(void) {
HINSTANCE Dll = LoadLibrary("Serve3L.dll");
if (!Dll) {
MessageBox(0, "Cannot access Server3L.dll",
"Fatal Error", MB_OK);
return NULL;
}
FARPROC Get = GetProcAddress(Dll, "Get3LServer");
if (!Get) {
MessageBox(0, "Get3LServer not in library Server3L.dll",
"Fatal Error", MB_OK);
return NULL;
}
typedef void *((*GetType)(int));
return (CServe3L *)((GetType)Get)(0);
}
The steps needed to run an application are as follows:
1.
|
Get a pointer to the server object:
CServe3L *S = GetServer(); // NULL on error
|
2.
|
(optional) Bring up a dialog to allow you to set server options:
S->OM->RequestOptions();
|
3.
|
Create an object to allow the server to communicate with this code:
G = new Com(this); // see below
S->Initialise(G);
|
4.
|
Get a pointer to the board's Link object. This can be done in two ways:
a.
|
Ask you to select a board:
S->LM->LinkDialog(0);
Link *L = S->LM->SelectedLink(); // NULL on error
|
b.
|
Look for a specific board:
Link *L = S->LM->LocateLink("XYZ", 0); // NULL on error
|
|
5.
|
Notify the server which link is to be used to access the CPUs:
S->UseLink(L);
|
6.
|
(optional) Set a call-back to deal with special clusters. See the sample WinApp for an example of this.
|
7.
|
Define the application to be loaded:
S->SetAppFile("my.app");
|
8.
|
Reset the processors:
S->Reset(1);
|
9.
|
Load the application and start the processors running:
S->LoadAndGo();
This call starts the server running as a separate thread and returns.
From this point on, the host link is under the complete control of the server and should not be used except as the result of a specific request from the running application.
|
When the application terminates, the communication object's Terminated member is called, G->Terminated(Return_Code), see step 3.
|