#!F-adobe-helvetica-medium-r-normal--18*
#!N 
#!CNavyBlue #!N  #!Rinitex Initialization 
and Exit #!N #!EC #!N #!N These routines enable an application 
to initiate and terminate connections with Data Explorer. DXLStartDX establishes a 
connection  #!F-adobe-times-bold-r-normal--18*   *conn #!EF for a Data Explorer instance. It is 
through this connection that information is sent and received during a 
Data Explorer session. #!N #!I0 #!N #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   
void DXLCloseConnection(DXLConnection *conn) #!EF #!EF #!I50 #!N Closes the connection to 
Data Explorer (  #!F-adobe-times-bold-r-normal--18*   *conn #!EF ) and frees the memory 
allocated to  #!F-adobe-times-bold-r-normal--18*   *conn #!EF but does not terminate the Data 
Explorer session. #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   DXLConnection *DXLConnectToRunningServer(int port, const 
char *host) #!EF #!EF #!I50 #!N This routine is used primarily 
for debugging purposes, to connect to a server (i.e., dxexec or 
dxui) that has already been started externally and is waiting for 
a connection (see -exonly and -appPort options). The routine creates a 
connection between the calling application and Data Explorer at the specified 
port on the specified host. #!N #!N The parameter  #!F-adobe-times-bold-r-normal--18*   port 
#!EF must be greater than or equal to zero. If  #!F-adobe-times-bold-r-normal--18*   
host #!EF is specified as NULL, the function uses "localhost." #!N 
#!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   DXLError DXLExitDX(DXLConnection *conn) #!EF #!EF #!I50 #!N 
Closes the connection to Data Explorer (  #!F-adobe-times-bold-r-normal--18*   *conn #!EF ) 
and terminates the Data Explorer session. Returns OK or ERROR. #!N 
#!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   int DXLGetSocket(DXLConnection *conn) #!EF #!EF #!I50 #!N 
Returns the socket number associated with connection  #!F-adobe-times-bold-r-normal--18*   *conn #!EF . 
#!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   DXLError DXLInitializeXMainLoop(XtAppContext app, DXLConnection *conn) #!EF 
#!EF #!I50 #!N Initializes the X11 window system so that calls 
to XtAppMainLoop will cause messages to be processed. (See  #!Lmsgsys,dxall1147 h Messaging System  #!EL  .) 
#!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   int DXLSetMessageDebugging(DXLConnection *c, int on) #!EF 
#!EF #!I50 #!N Specifies the on-off status of message debugging. If 
it is enabled, messages are printed to the terminal window as 
they are sent or received. The return value identifies the previous 
state of message debugging. #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   void DXLSetSynchronization(DXLConnection 
*conn, const int onoff) #!EF #!EF #!I50 #!N Sets the synchronization 
status of the connection to Data Explorer. When  #!F-adobe-times-bold-r-normal--18*   onoff #!EF 
is set to 1, the connection is synchronized; when set to 
0, it is not. With the connection synchronized, routines wait for 
a response from the "server" (i.e., UI or exec) after a 
message is sent. For example, if synchronization has been turned on, 
a call to DXLSetValue will not return until the server has 
processed the set value. #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   DXLConnection *DXLStartDX(const 
char *string, char *host) #!EF #!EF #!I50 #!N Starts Data Explorer 
and creates a connection to it. The parameter  #!F-adobe-times-bold-r-normal--18*   *string #!EF 
is the command that would be used to start Data Explorer 
at the command line. For example,  #!F-adobe-times-bold-r-normal--18*   string #!EF could be: 
#!CForestGreen #!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N dx -image -mdf user.mdf #!EF #!N 
#!N #!EC #!N #!N Note that you must specify either -image, 
-edit, or -menubar in order to bypass the Data Explorer Startup 
window. It is not possible to use DXLStartDX to start Data 
Explorer via the Startup window. The parameter  #!F-adobe-times-bold-r-normal--18*   *host #!EF is 
the name of the host on which Data Explorer is to 
be run. If specified as NULL, the local host is assumed. 
#!N #!N The routine returns a pointer to a DXLConnection on 
success or it returns NULL and sets an error code (available 
in the global variable  #!F-adobe-times-bold-r-normal--18*   errno #!EF ). The connection structure, 
specified by #!CForestGreen #!N #!N  #!F-adobe-courier-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   #!N typedef struct DXLConnection 
DXLConnection; #!EF #!EF #!N #!N #!EC #!N #!N is the primary 
structure used by DXLink for maintaining information about the connection to 
the server. This DXLConnection is passed to most DXLink routines to 
indicate the relevant server connection. #!N #!N To start the Data 
Explorer executive and connect DXLink to it, you might issue the 
following call: #!CForestGreen #!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N DXLStartDX("dx -cache off -exonly"); 
#!EF #!N #!N #!EC #!N #!N The -exonly flag causes the 
executive to start up and to wait for a connection from 
DXLink. It is therefore required when connecting to the executive. Note 
that the "-script" option should not be used, as it causes 
the executive to start up in script mode, which requires commands 
typed directly at a prompt, bypassing the message system. #!N #!N 
Similarly, a connection to the Data Explorer user interface can be 
initiated with the command: #!N #!N DXLStartDX("dx -edit -mdf my.mdf -image"); 
#!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   void DXLSetBrokenConnectionCallback(DXLConnection *conn, #!EF void (*proc)(DXLConnection 
*, void *), void *data); #!EF #!I50 #!N Allows the application 
to install a routine to be called when the connection to 
Data Explorer is broken. #!I0 #!N #!N #!N #!N #!N  #!F-adobe-times-medium-i-normal--18*   
Next Topic #!EF #!N #!N  #!Lmsgsys,dxall1147 h Messaging System  #!EL  #!N  #!F-adobe-times-medium-i-normal--18*   #!N 
