🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
2 messages
2 total messages Started by Mark Brown Thu, 04 Nov 1999 00:00
IProviderPtr vs. IProvider * : A related problem
#1527
Author: Mark Brown
Date: Thu, 04 Nov 1999 00:00
44 lines
2314 bytes
(Please excuse the cross-post, as I found that this group seems to be
tackling this problem more than the group I previously posted this
too.)

Hi everyone-

After installing patch 1 and 2 for CPP Builder 4, we have encountered
this new phenomenon of type library changes.  I have read the
work-around for getting the exported tables and queries from the app
server to work for the client.  However, another piece of our code
(which I never fully understood) has now broken.

We had a callback implementation in place where the client was passing
a pointer to its sink object to the server so the server could notify
it when needed.  The data type of the object used to be declared as:

    CComPtr <IClientSink> mySinkPointer;

So, I would create my sink by:

    CComObject <TClientSink> *Sink = new CComObject <TClientSink>;
    mySinkPointer = Sink;

Finally, after obtaining a pointer to the server callback object, the
client would pass the pointer to the sink to the server by:

     HRESULT hr = pServerCallbackObject->Connect(mySinkPointer, (long
*)&Cookie);

whereby the Connect method would use the mySinkPointer to pass to the
Advise method of the IConnectionPointImpl.

Whew...now the problem is that originally, the Connect method had a
IClientSink * variable type for the first parameter, and now it has
been changed to IClientSinkPtr variable type.  I can't seem to get the
correct address of my sink sent over to the server callback object due
to this variable type change, and I don't have enough information
about this new variable type.

Anyone have any clues?  Do I need to cast it somehow to a (IClientSink
*) variable on the client and/or server?

Thanks,
Mark Brown
Re: IProviderPtr vs. IProvider * : A related problem
#1381
Author: Mark Brown
Date: Thu, 04 Nov 1999 00:00
32 lines
1565 bytes
Hi-

I found that if I changed the Connect interface method to accept an
IClientSinkPtr * variable instead of a IClientSinkPtr variable, I was
able to successfully get my code to work.

Interesting thing I found...While performing this cast (at the end of
code snip-it):

    CComPtr <IClientSink> mySinkPointer;
    CComObject <TClientSink> *Sink = new CComObject <TClientSink>;
    mySinkPointer = Sink;

   IClientSinkPtr *myClientSinkPtrPtr =
(IClientSinkPtr*)&mySinkPointer;   // <--This cast

an ASSERT error was raised in atlbase.h.  By just ignoring it, the
code worked fine.

Specifically, in lines 325-327:
  // The assert on operator& usually indicates a bug.  If this is
really
  // what is needed, however, take the address of the p member
explicitly.
  T** operator&() { _ASSERTE(p==NULL); return &p; }

Seems like this might be a bug, and should be (p!=NULL).

Comments?

Hope this helps,
Mark
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