Error Handling with the C Connector

Errors in function calls are indicated by the return value. If the function returns an int, 0 indicates an error. If the function returns a long, -1 indicates an error. If the function returns a handle, 0 indicates an error. When an error is detected, use GetNumMessages, GetErrorMessage, and GetLocalizedMessage to access the error messages. GetNumMessages returns the number of the error message. GetErrorMessage and GetLocalizedMessage can be used to retrieve each error message. GetLocalizedMessage will return a localized message if localization is enabled, otherwise it will return the default error message.

  long nMessageLen;
  char *strMessage;
  for (int i = 0; i < GetNumMessages(hSess); i++)
	nMessageLen = GetErrorMessage(hSess, i, 0, 0);
	strMessage = malloc(nMessageLen + 1);
	GetErrorMessage(hSess, i, strMessage, nMessageLen);
	printf("Apptrieve error: %s\n", strMessage);


Fork Considerations on UNIX

There are restrictions to the use of the fork() system call when using the AppConn C for UNIX connector. The fork() system call cannot be used while any AppConn session handles are held by the user's application. The system call may be used prior to creating a session with CreateSession() or after all session handles have been released with ReleaseSession().