🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
6 messages
6 total messages Started by noel Mon, 17 Oct 2005 21:05
Using Synchronize with TIdHTTPServer ...
#3335
Author: noel
Date: Mon, 17 Oct 2005 21:05
41 lines
2136 bytes
Hello all !

I am trying to write a HTTP server using the
TIdHTTPServer component under C++Builder V6 and Indy 9
and am having a problem with using / understanding the use
of the the Synchronize function ...

void __fastcall TMainForm::IdHTTPServer1CommandGet(TIdPeerThread 
AThread, TIdHTTPRequestInfo *ARequestInfo, TIdHTTPResponseInfo 
*AResponseInfo)
{
  ...


   AThread -> Synchronize (DisplayServerTrace); <= Error !


void TMainForm::DisplayServerTrace (void)
{
   RequestsCount ++;
   EditRequestsCount -> Text = IntToStr (RequestsCount);
   StringGridServerTraces -> Cells[1][CurrentThreadIndex + 1] = TraceString;
}

When trying to call AThread -> Synchronize  i get a link error:
"Member function must be called or its address taken" !

I have used Synchronize many times with the TThread class but
why doesn't it work with the TidThread descendant ?

Am i missing something ?
Somrthing is wrong with the (re)definition of Synchronize ?

Thhanks for any help !

Please if possible CC to my email address also ...
as i don't check the newsgroup too often ...

Many thanks !

No�l
Re: Using Synchronize with TIdHTTPServer ...
#3337
Author: Remy Lebeau (TeamB)
Date: Mon, 17 Oct 2005 22:21
13 lines
1296 bytes
"noel" <noel@teledata.qc.ca> wrote in message
news:4354113a$1@newsgroups.borland.com...

> void TMainForm::DisplayServerTrace (void)

Your method is not declared correctly.  It must use the __fastcall calling
convention, ie:

    void __fastcall TMainForm::DisplayServerTrace (void)


Gambit
Re: Using Synchronize with TIdHTTPServer ...
#3338
Author: noel
Date: Mon, 17 Oct 2005 22:47
41 lines
2086 bytes
Hello Remy ...

My example code was wrong ... but even with the
proper declaration i have the same result ... ???
void __fastcall TMainForm::DisplayServerTrace (void)

Link error : Member function must be called or its address taken	

on

AThread -> Synchronize (DisplayServerTrace);
or
AThread -> Synchronize ((TThreadMethod) DisplayServerTrace);

Now this:
AThread -> Synchronize (DisplayServerTrace);

... links OK but of course doesn't work properly ...
That's why i suspected something wrong int the redeclaration
of the Synchronize () in TidThread ... (?)

No�l


Remy Lebeau (TeamB) wrote:
> "noel" <noel@teledata.qc.ca> wrote in message
> news:4354113a$1@newsgroups.borland.com...
> 
> 
>>void TMainForm::DisplayServerTrace (void)
> 
> 
> Your method is not declared correctly.  It must use the __fastcall calling
> convention, ie:
> 
>     void __fastcall TMainForm::DisplayServerTrace (void)
> 
> 
> Gambit
> 
> 
Re: Using Synchronize with TIdHTTPServer ...
#3339
Author: noel
Date: Mon, 17 Oct 2005 23:58
53 lines
2415 bytes
noel wrote:

Sorry i meant
  AThread -> Synchronize (&DisplayServerTrace);
 >
 > ... links OK but of course doesn't work properly ...
 > That's why i suspected something wrong int the redeclaration
 > of the Synchronize () in TidThread ... (?)

> Hello Remy ...
> 
> My example code was wrong ... but even with the
> proper declaration i have the same result ... ???
> void __fastcall TMainForm::DisplayServerTrace (void)
> 
> Link error : Member function must be called or its address taken   
> 
> on
> 
> AThread -> Synchronize (DisplayServerTrace);
> or
> AThread -> Synchronize ((TThreadMethod) DisplayServerTrace);
> 
> Now this:
> AThread -> Synchronize (DisplayServerTrace);
> 
> ... links OK but of course doesn't work properly ...
> That's why i suspected something wrong int the redeclaration
> of the Synchronize () in TidThread ... (?)
> 
> No�l
> 
> 
> Remy Lebeau (TeamB) wrote:
> 
>> "noel" <noel@teledata.qc.ca> wrote in message
>> news:4354113a$1@newsgroups.borland.com...
>>
>>
>>> void TMainForm::DisplayServerTrace (void)
>>
>>
>>
>> Your method is not declared correctly.  It must use the __fastcall 
>> calling
>> convention, ie:
>>
>>     void __fastcall TMainForm::DisplayServerTrace (void)
>>
>>
>> Gambit
>>
>>
Re: Using Synchronize with TIdHTTPServer ...
#3340
Author: Remy Lebeau (TeamB)
Date: Tue, 18 Oct 2005 00:19
42 lines
2432 bytes
"noel" <noel@teledata.qc.ca> wrote in message
news:4354290e$1@newsgroups.borland.com...

> My example code was wrong ...

For future reference, please ALWAYS copy/paste your actual code as-is.
Don't re-type it manually.  It leads to too many mistakes and
misunderstandings.

> Link error : Member function must be called or its address taken

That is not a linker error.  That is a compiler error.  Compiling and
Linking are two very separate operations.

> AThread -> Synchronize (DisplayServerTrace);
> or
> AThread -> Synchronize ((TThreadMethod) DisplayServerTrace);

There is no possible way for that code, with or without the correction, to
cause that particular error.  I have seen TIdThread::Synchronize() cause
"Could not found match for..." errors before, but there is no reason for
your particular error to occur.

> Now this:
> AThread -> Synchronize (DisplayServerTrace);
> ... links OK but of course doesn't work properly ...

Look at that line again, and then look further above.  That is the EXACT
same line that you said is erroring.

> That's why i suspected something wrong int the redeclaration
> of the Synchronize () in TidThread ... (?)

Try commenting out the TMethod overloaded version of Synchronize() in
IdThread.hpp.

The alternative is to use a TIdSync-derived class instead of using
TIdThread::Synchronize().


Gambit
Re: Using Synchronize with TIdHTTPServer ...
#3341
Author: Remy Lebeau (TeamB)
Date: Tue, 18 Oct 2005 00:20
15 lines
1460 bytes
From: "noel" <noel@teledata.qc.ca>
Subject: Re: Using Synchronize with TIdHTTPServer ...
Date: Monday, October 17, 2005 4:58 PM

> Sorry i meant
>   AThread -> Synchronize (&DisplayServerTrace);
>>
>> ... links OK but of course doesn't work properly ...

Just saying it doesn't work says nothing at all about the actual problem you
are having.  You need to provide specific details.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads