Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2016, 06:16 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default complie error

I have this code

HTML Code:
type
LPWSAOVERLAPPED_COMPLETION_ROUTINE = procedure ( const dwError, cbTransferred : DWORD; const lpOverlapped : LPWSAOVERLAPPED; const dwFlags : DWORD ); stdcall;

 TWSASock = class(Tobject)
  private
   FWSAOverlap: WSAOverlapped;
  .........
  Procedure EventCompleation(Const evError, TransferedSize: DWord; Const Overlapped: PWSAOverlapped; Const Flag: DWord); stdcall;
  .........
end;
implementation
..........................................
procedure TWSASock.StartUpEvent;
Var 
    Count: DWord;
    CR: LPWSAOVERLAPPED_COMPLETION_ROUTINE;
begin
 CR := @EventCompleation(0, Count, @FWSAOverlap, 0);
  ........
end;
   .........
procedure TWSASock.EventCompleation(evError, TransferedSize: DWord;
  var Overlapped: WSAOverlapped; Flag: DWord);
begin

end;
this is using winsock2
I get the error error:- variable required at the end of EventCompleation

LPWSAOVERLAPPED_COMPLETION_ROUTINE is a procedure and EventCompleation is a copy.
FWSAOverlap: WSAOverlapped; allocates a variable block
And when used its a pointer of a pointer because of the Const.
But i do not understand the compile error:- verable required

Last edited by lexd; 08-17-2016 at 06:18 AM.
Reply With Quote
  #2  
Old 08-21-2016, 11:49 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

I found a compiler error
The Delphi compiler has problems with C++ stdcall;

example
WSAOVERLAP_COMPLETION = procedure(const dwError, cbTransferred: DWORD;
const lpOverlapped : LPWSAOVERLAPPED; const dwFlags: DWORD); stdcall;

This is common with creating an event but not conceived for C++ calls
what does one do about it?
Reply With Quote
Reply

Tags
delphi

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:46 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.