KVXMLStartOOPSession()
This function performs the following:
-
Initializes the out-of-process session.
-
Specifies the input stream or file.
-
Sets conversion options in the
KVXMLTemplate,KVXMLOptions, andKVXMLTOCOptionsdata structures. -
Creates a Servant process.
-
Establishes a communication channel between the application thread and the Servant.
-
Sends the data to the Servant.
Syntax
BOOL pascal KVXMLStartOOPSession( void *pContext, KVInputStream *pInputStream, char *pFileName, KVXMLTemplate *pTemplates, KVXMLOptions *pOptions, KVXMLTOCOptions *pTOCCreateOptions DWORD *pPID, KVErrorCode *pError DWORD dwOptions, void *pReserved1, void *pReserved2 );
Arguments
|
|
A pointer returned from fpInit() or fpInitWithLicenseData(). |
|
|
A pointer to the developer-assigned instance of If |
|
|
A pointer to the file to be converted. The file must exist on the same file system as the Servant. If |
|
|
A pointer to the If this pointer is |
|
|
A pointer to the If this pointer is |
|
|
A pointer to the If this pointer is |
|
|
The address of a |
|
|
A pointer to an error code defined in |
|
|
Reserved for future use. |
|
|
Reserved for future use. |
|
|
Reserved for future use. |
Returns
-
If the call is successful, the return value is
TRUE. -
If the call is unsuccessful, the return value is
FALSE.
Discussion
-
After the out-of-process session is started successfully, all conversion functions can be called. The data is then processed on the Servant until the session is terminated by a call to KVXMLEndOOPSession().
-
All functions that can run out of process must be called within the out-of-process session, that is, after the call to
KVXMLStartOOPSession(), and before the call toKVXMLEndOOPSession(). -
The
KVXMLConvertFile(), andfpGetSummary()functions can be called only once in a single out-of-process session. -
Because the
KVXMLTemplate,KVXMLOptions, andKVXMLTOCOptionsdata structures are passed by this function, the same pointers in the call toKVXMLConvertFile()are ignored.
Example
The following sample code is from the cnv2xmloop sample program:
/* declare OOP startsession function pointer */
BOOL (pascal *fpKVXMLStartOOPSession)( void *,
KVInputStream *,
char *,
KVXMLTemplate *,
KVXMLOptions *,
KVXMLTOCOptions *,
DWORD *,
KVErrorCode *,
DWORD ,
void *,
void * );
/* assign OOP startsession function pointer */
fpKVXMLStartOOPSession = (BOOL (pascal *)( void *,
KVInputStream *,
char *,
KVXMLTemplate *,
KVXMLOptions *,
KVXMLTOCOptions *,
DWORD *,
KVErrorCode *,
DWORD ,
void *,
void * ))mpGetProcAddress(hKVXML, "KVXMLStartOOPSession");
if(!fpKVXMLStartOOPSession)
{
printf("Error assigning KVXMLStartOOPSession() pointer\n");
(*KVXMLInt.fpFileToInputStreamFree)(pKVXML, &Input);
(*KVXMLInt.fpFileToOutputStreamFree)(pKVXML, &Output);
mpFreeLibrary(hKVXML);
return 7;
}
/********START OOP SESSION *****************/
if(!(*fpKVXMLStartOOPSession)(pKVXML,
&Input,
NULL,
&XMLTemplates, /* Markup and related variables */
&XMLOptions, /* Options */
NULL, /* TOC options */
&oopServantPID,
&error,
0,
NULL,
NULL))
{
printf("Error calling fpKVXMLStartOOPSession \n");
(*KVXMLInt.fpFileToInputStreamFree)(pKVXML, &Input);
(*KVXMLInt.fpFileToOutputStreamFree)(pKVXML, &Output);
(*KVXMLInt.fpShutDown)(pKVXML);
mpFreeLibrary(hKVXML);
return 9;
}