🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages Started by Darlington ADIBE Fri, 18 Nov 2005 21:12
new keyword in COM Object
#3113
Author: Darlington ADIBE
Date: Fri, 18 Nov 2005 21:12
22 lines
1527 bytes
Hi,

is it valid to use the keyword 'new' with a COM Obj.

I have a class i derived from TIdTCPClient,
In one of the method of my COM Obj I created an instance of the class with
the keyword new

TTCPPro *tcpp;
tcpp = new TTCPPro(NULL);

when i build i get this linker error

[Linker Error] Unresolved external '__fastcall
Idtcpclient::TIdTCPClient::SetPortA(const int)' referenced from
C:\STUDIO\ESEMES\PROTOCOL.OBJ

But if i comment out the  tcpp = new TTCPPro(NULL);
it compile

if it is invalid to the new keyword with a COM Impl. How can I create an
instance of my class TTCPPro for use in th COM Impl?
Re: new keyword in COM Object
#3114
Author: Andrue Cope [TeamB]
Date: Mon, 21 Nov 2005 08:21
25 lines
1933 bytes
Darlington ADIBE wrote:

> But if i comment out the  tcpp = new TTCPPro(NULL);
> it compile
> 
> if it is invalid to the new keyword with a COM Impl. How can I create
> an instance of my class TTCPPro for use in th COM Impl?

There is nothing wrong with using 'new'. The problem is that the linker
can't find the code for the method
Idtcpclient::TIdTCPClient::SetPortA(). The reason that removing the
allocation makes the problem go away is likely to be that the
constructor of that class 'TTCPPro()' is calling that method. Take away
the object construction and nothing else is calling that function so
the linker doesn't need to find it.

As to why the linker can't find that method I'm not sure. Presumably
there is a LIB (perhaps an OBJ) that needs adding to your project but
what I know of sockets under BCB suggests that it ought to all be
automatic.

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Re: new keyword in COM Object
#3116
Author: Remy Lebeau (TeamB)
Date: Mon, 21 Nov 2005 18:04
28 lines
1714 bytes
"Darlington ADIBE" <bcb@triative.com> wrote in message
news:437ebf9f@newsgroups.borland.com...

> is it valid to use the keyword 'new' with a COM Obj.

Yes.

> when i build i get this linker error

That error has nothing to do with using the 'new' keyword.

> [Linker Error] Unresolved external '__fastcall
> Idtcpclient::TIdTCPClient::SetPortA(const int)' referenced from
> C:\STUDIO\ESEMES\PROTOCOL.OBJ

That error is a known problem with Microsoft's headers in the VCL.  Have a
look at the following articles for details:

    How do I get rid of the unresolved external to SetPortA when using
Socket components?
    http://bdn.borland.com/article/0,1410,21494,00.html

    linker error- unresolved external TAbstractSocket::SetPortA
    http://bdn.borland.com/article/0,1410,20125,00.html


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