Hi,

the problem I report here may be a real bug or simply the fact I did not find
the correct option in cegcc ...
It is related to structure packing that seems to be sometimes incompatible with
what WinCE API expects. See the example below :

=========================================================================================
typedef struct MSGQUEUEOPTIONS_OS { // from msgqueue.h
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dwMaxMessages;
    DWORD cbMaxMessage;
    BOOL  bReadAccess;
} MSGQUEUEOPTIONS, FAR *LPMSGQUEUEOPTIONS, *PMSGQUEUEOPTIONS;

static MSGQUEUEOPTIONS opt;

int sc_msg_init (ClientData cd, Tcl_Interp * ti, int argc, const char ** argv) {
  opt.dwSize = sizeof(MSGQUEUEOPTIONS);
  opt.dwFlags = MSGQUEUE_NOPRECOMMIT;// |MSGQUEUE_ALLOW_BROKEN;
  opt.dwMaxMessages = 0;
  opt.cbMaxMessage = 1024;
  opt.bReadAccess = FALSE;
  hw = CreateMsgQueue( (LPCWSTR) "scid2toga", &opt );
  if ( ! hw )
    return errorResult (ti, "CreateMsgQueue w failed");

  opt.bReadAccess = TRUE;
  hr = CreateMsgQueue( (LPCWSTR) "toga2scid", &opt );
  if ( ! hr )
    return errorResult (ti, "CreateMsgQueue r failed");

  return TCL_OK;
}
=======================================================================================

It works perfectly well and I can use message queues for IPC between a chess
engine and the user interface.
But if the variable "opt" is on the stack, that is defined as a local variable
in function sc_msg_init, then sometimes, depending of the directory installation
of my application, the message queue took the wrong "opt.bReadAccess" parameter,
that is opened a queue "read-only" instead of "write-only" or the opposite. So I
concluded that I have a problem in the way structures are packed using cegccc,
problem that seems to disappear when using a global variable.
I tried to play with "-mstructure-size-boundary" option without success, and I
found no other option in cegcc that could solve this problem (and no real clue
in evc4 documentation).

So *maybe* is there a bug here ? Or something I did not understand ?

Pascal



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to