Custom Report

Type Aliases

A3DInt32 (*

A3DCallbackReportMessage

A3DInt32 (*

A3DCallbackReportWarning

A3DInt32 (*

A3DCallbackReportError

Functions

A3DStatus

A3DDllSetCallbacksReport

Detailed Description

group a3d_message_functions

Specifies custom reporting of messages.

The function and types in this section enable you to customize reporting of messages, warnings, and errors from the library.

These messages are the ones returned by the PRC core reading, being independent from the ones being potentially sent to log file, when using A3DAsmModelFileLoadFromFile.

Type Alias Documentation

typedef A3DInt32 (*A3DCallbackReportMessage)(A3DUTF8Char*)

A callback function the library invokes to report general messages. These messages are English only.

If this callback function is not provided, the library sends warning messages to the null device.

Version

2.0

typedef A3DInt32 (*A3DCallbackReportWarning)(A3DUTF8Char*, A3DUTF8Char*)

A callback function the library invokes to report warnings. The returned message begins with a unique error code, which you can use for localization. In some cases, the second argument provides additional information about the warning. These messages are English only.

If this callback function is not provided, the library sends warning messages to the null device.

Version

2.0

typedef A3DInt32 (*A3DCallbackReportError)(A3DUTF8Char*, A3DUTF8Char*)

A callback function the library invokes to report error messages. The returned message begins with a unique error code, which you can use for localization. In some cases, the second argument provides additional information about the error. These messages are English only.

If this callback function is not provided, the library sends error messages to the null device.

Version

2.0

Function Documentation

A3DStatus A3DDllSetCallbacksReport(A3DCallbackReportMessage, A3DCallbackReportWarning, A3DCallbackReportError)

Specifies custom functions the library uses for reporting messages, warnings and errors.

This function configures the library with the callback functions the library uses for reporting messages, warnings and errors.

To ensure your callback is aware of early-occurring messages, call the A3DDllSetCallbacksReport function immediately after the A3DDllInitialize function is successfully called.

Version

2.0

Sample code

A3DInt32 my_message(A3DUTF8Char *msg) { _tprintf(_T("%s"),msg); return fflush(stdout); }
A3DInt32 my_warning(A3DUTF8Char* pcCode, A3DUTF8Char *msg) { _tprintf(_T("WARNING #%s:"),pcCode); return my_message(msg); }
A3DInt32 my_error(A3DUTF8Char* pcCode, A3DUTF8Char *msg) { _tprintf(_T("ERROR #%s:"),pcCode); return my_message(msg); }

A3DInt32 iErr = A3D_SUCCESS;
A3DInt32 iMajorVersion,iMinorVersion = 0;

iErr = A3DDllGetVersion( &iMajorVersion, &iMinorVersion );
iErr = A3DDllInitialize( A3D_DLL_MAJORVERSION, A3D_DLL_MAJORVERSION );
if ( iErr == A3D_SUCCESS )
{
    iErr = A3DDllSetCallbacksReport( my_message , my_warning , my_error );
    iErr = A3DDllTerminate();
}

Warning

If you do not call this function, the library sends all messages to the null device. The first string returned by the two functions above corresponds to a unique error code. You can use that code to localize messages supplied to your users.

Return values:
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_SUCCESS

Returns:

A3D_SUCCESS on success, or an error code on failure