EldoS | Feel safer!

Software components for data protection, secure storage and transfer

OnMessage STDCALL "Calling conventions differ"

Posted: 04/23/2013 18:00:23
by David Smith (Standard support level)
Joined: 11/08/2012
Posts: 2

I am trying to compile the sample code for the project MsgForward.dpr using either Delphi 6 or Delphi XE3. Both give the compile error "Incompatible types: 'Calling conventions differ'. I have not modified the project other than add the core folder (class libraries) to the project's search path.

Please let me know what I am doing wrong or how to fix this error. Thank you.


program MsgForward;

{$apptype console}

  {$ifndef LINUX}

{$R *.RES}


     TBaseForwardThread = class(TThread)
       Messenger : TMCMessenger;
       Queue     : TMCQueue;
       DirectTransport : TMCDirectTransport;

       StartedFlag : TSimpleEvent;
       StopFlag : TSimpleEvent;

       procedure Execute; override;
       procedure InitLocals;
       procedure DeinitLocals;
       procedure DoHandleMessage(var Message : TMCMessage; var Handled : boolean); virtual; abstract;
// note STDCALL calling convention in OnMessage handler
       procedure OnMessage(Sender : TObject; var Message : TMCMessage; var Handled : boolean); stdcall;
       constructor Create; reintroduce;
       procedure StartThread;
       procedure StopThread;

procedure TBaseForwardThread.InitLocals;
  Messenger := TMCMessenger.Create(nil);

  Queue := TMCQueue.Create(nil);
  with Queue do
    Name := 'Queue';
    Messenger := Self.Messenger;
    QueueName := 'SampleQueue';
    OnUnhandledMessage := OnMessage;

  DirectTransport := TMCDirectTransport.Create(nil);
  with DirectTransport do
    Messenger := Self.Messenger;
    Active := true;

It also fails on the Messenger.SendMessageTimeoutCallback line below...
        Messenger.SendMessageTimeoutCallback('Local:' + Server.DirectTransport.TransportID + '|SampleQueue', Message, 5000, OnCompletion, OnTimeout, OnError, 0, nil);
        on E : Exception do
Posted: 04/24/2013 00:02:33
by Eugene Mayevski (Team)

In MsgConnect 2 "stdcall" convention was removed from the code (it was used in MsgConnect 1). I have reviewed MsgConnect 2 (both core and demos) code and I see that stdcall is used in core's events when DLLBUILD define is set (which should not be set for demos).

So please recheck that samples are compiled against the correct version of MsgConnect core units.

On a side note please mark your code blocks with CODE tag or corresponding CODE button. I'll do this in your message myself now.

Sincerely yours
Eugene Mayevski



Topic viewed 7560 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!