Author |
Topic |
|
abinoe
New Member
2 Posts |
Posted - Dec 22 2005 : 09:26:35 AM
|
I have build 1437 on XP home, VS 2003, C++
with the following code : CXmlNodeWrapper CXmlNodeWrapper::InsertChildNodeElement(int index, LPCTSTR nodeName, LPCTSTR value) { MSXML2::IXMLDOMNodePtr newNode = InsertChildNodeElement(index, nodeName); if(newNode != NULL) { newNode->PutdataType(_T("string")); newNode->PutnodeTypedValue(value); } return newNode; }
If I click on PutdataType, or PutnodeTypedValue, VAssist shows me : "Interface* operator->() const" , and not those smart pointer methods ... It seems to have troubles with the -> accessor. The same thing is displayed while hovering over those methods.
Thank you for your reply, Patrick REY |
|
ether
Tomato Guru
USA
130 Posts |
Posted - Dec 22 2005 : 09:48:15 AM
|
quote: Originally posted by abinoe
I have build 1437 on XP home, VS 2003, C++
with the following code : CXmlNodeWrapper CXmlNodeWrapper::InsertChildNodeElement(int index, LPCTSTR nodeName, LPCTSTR value) { MSXML2::IXMLDOMNodePtr newNode = InsertChildNodeElement(index, nodeName); if(newNode != NULL) { newNode->PutdataType(_T("string")); newNode->PutnodeTypedValue(value); } return newNode; }
If I click on PutdataType, or PutnodeTypedValue, VAssist shows me : "Interface* operator->() const" , and not those smart pointer methods ... It seems to have troubles with the -> accessor. The same thing is displayed while hovering over those methods.
Thank you for your reply, Patrick REY
I've noticed this also, but figured that the behavior was correct since the smart pointer really is an instance of a class with an operator->() override and not a pointer.
Think of it this way, MSXML2::IXMLDOMNodePtr is a class. You created an instance of the class like this:
MSXML2::IXMLDOMNodePtr newNode You access an instance's members like this:
newNode. and not
newNode-> I think this is where their parser breaks down with smart pointers. I think that it would be possible for their parser to notice that a class overrides operator->() and then display the propper info depending on context. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Dec 22 2005 : 3:41:12 PM
|
not being familiar with these classes i am not certain i am following this correctly. does this seem to be the same problem as here http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=4239 ?
placing the caret inside "MSXML2::IXMLDOMNodePtr" is giving me:
_COM_SMARTPTR_TYPEDEF(IXMLDOMNode, __uuidof(IXMLDOMNode))
in VA's definition bar, which is putting me in mind of the template smart pointer class CComQIPtr. |
zen is the art of being at one with the two'ness |
|
|
ether
Tomato Guru
USA
130 Posts |
Posted - Dec 22 2005 : 6:22:14 PM
|
quote: Originally posted by feline
not being familiar with these classes i am not certain i am following this correctly. does this seem to be the same problem as here http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=4239 ?
placing the caret inside "MSXML2::IXMLDOMNodePtr" is giving me:
_COM_SMARTPTR_TYPEDEF(IXMLDOMNode, __uuidof(IXMLDOMNode))
in VA's definition bar, which is putting me in mind of the template smart pointer class CComQIPtr.
I don't know if the two issues are related, nor am I familiar with the smart pointer class he is using. Just trying to illustrate why VAX may be doing what it is doing.
Basically, a smart pointer isn't a pointer at all. It is a class instance that wraps a pointer and then frees it when the class goes out of scope. In order to access the instance the same way that you access a pointer, you need to override the operator->(). COM smart pointers are derived from the template _com_ptr_t which declares the operator->() as follows:
Interface* operator->() const throw(_com_error)
{
if (m_pInterface == NULL) {
_com_issue_error(E_POINTER);
}
return m_pInterface;
}
The template class starts as follows:
template<typename _IIID> class _com_ptr_t {
public:
// Declare interface type so that the type may be available outside
// the scope of this template.
//
typedef _IIID ThisIIID;
typedef typename _IIID::Interface Interface;
.
.
.
.
private:
// The Interface.
//
Interface* m_pInterface;
VAX doesn't realize that when you instantiate a smart pointer and call through -> that it is actually calling through the m_pInterface of type typename _IIID::Interface. |
Edited by - ether on Dec 22 2005 6:24:37 PM |
|
|
abinoe
New Member
2 Posts |
Posted - Dec 23 2005 : 08:06:25 AM
|
The fact is that it was working, with my previous (a few month...)release of VAssist ! This means that when I clicked on the 'Go' button, I was sent the smart pointer implementation of PutdataType, not on the smart pointer template class :
Before : msxml3.tli, line 1926 inline void IXMLDOMNode::PutdataType ( _bstr_t dataTypeName ) { (I have now to use the VS2003 'Go to definition' function to get to it)
Now: comip.h, line 56 template<typename _IIID> class _com_ptr_t { public: ...
My config : VA_X.dll file version 10.2.1437.0 built 2005.12.10 Licensed to: VA X: [email protected] (1-user license) Support ends 2006.01.10 VA.NET 7.1: VAOpsWin.dll version 1.3.3.0 VATE.dll version 1.0.4.2 DevEnv.exe version 7.10.3077.0 msenv.dll version 7.10.3077.0 Font: Courier New 13(Pixels) Comctl32.dll version 5.82.2900.2180 WindowsNT 5.1 Build 2600 Service Pack 2 Single processor
Platform: Win32 Stable Includes: C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\include; C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\include; C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\PlatformSDK\\include; C:\\Program Files\\Microsoft Visual Studio .NET 2003\\SDK\\v1.1\\include; D:\\Program Files\\Rogue Wave\\Stingray Studio\\Include; D:\\Program Files\\Rogue Wave\\Stingray Studio\\Regex\\Include;
Library Includes: C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\src\\mfc; C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\src\\atl; C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\crt\\src; D:\\Program Files\\Rogue Wave\\Stingray Studio\\Src; D:\\Program Files\\Rogue Wave\\Stingray Studio\\Regex\\Src;
Other Includes:
|
|
|
ether
Tomato Guru
USA
130 Posts |
Posted - Dec 27 2005 : 2:11:40 PM
|
The thread http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=4231 is more like what I thought you were talking about in your first post. You never mentioned using the 'Go' button, only clicking on the function or looking at its tooltip.
What was the previous version that you used where this worked? I'm sure they will want to know so they may be able to go back and see how they did it then.
By the way, I'm using VC 6 on Win2K. |
Edited by - ether on Dec 27 2005 2:16:06 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Dec 27 2005 : 2:57:26 PM
|
ether i have some knowledge of smart pointers, but so far i have resisted the urge to write my own there are just SO many classes and API's i come across on this forum that i gave up hope of understanding more than a small percentage of them
the bigger problem is that i have learned that just because VA understands some C++ template code does not mean that it will understand other C++ template code, so i have to consider each case on its own.
abinoe do you remember which version of VA you were using before?
this suggests that VA's old C++ parser was correctly handling this specific case, but that the new parser is not handling it.
using the sample code you provided i am getting "odd" results. after adding the line:
#include "msxml2.h"
if i place the caret inside "IXMLDOMNodePtr"
in VA 1418 i get: context bar shows = IXMLDOMNodePtr definition bar shows = typedef _com_ptr_t<IXMLDOMNode> IXMLDOMNodePtr
in VA 1438 i get: context bar shows = MSXML2 definition bar shows = namespace MSXML2{...}
then doing alt-g on the function call: PutdataType(_T("string"));
VA 1418 beeps at me - it has no idea what this is or where to go
VA 1438 takes me to the file: c:\\program files\\microsoft visual studio .net 2003\\vc7\\include\\comip.h line = 56
so while i seem to have reproduced your problem in 1438 i have not been able to reproduce this working in 1418. there do not seem to be any differences between the two systems that would explain these results. |
zen is the art of being at one with the two'ness |
|
|
kevinsikes
Tomato Guru
USA
271 Posts |
|
ether
Tomato Guru
USA
130 Posts |
Posted - Dec 28 2005 : 06:44:50 AM
|
quote: Originally posted by feline
ether i have some knowledge of smart pointers, but so far i have resisted the urge to write my own there are just SO many classes and API's i come across on this forum that i gave up hope of understanding more than a small percentage of them
I can understand not writing your own. Hell, I prefer not to use any, if I can get away with it. They make the code harder to read for someone just starting out with COM.
I kind of figured you understood them a little, but I didn't want to assume you did. Just wanted to clarify why the parser may be having trouble and that it was reasonably understandable. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Dec 28 2005 : 6:04:25 PM
|
kevin, are you in a good position to re-test thread 4029 with VA 1418? if this used to work correctly with that version then i will bump the priority of your case, since breaking existing features is worse than finding a new bug. well, i consider it worse anyway
since i don't have any COM server code lying around (well, at least none that i know of ) i will have to rely on your results here.
it would be nice to reproduce abinoe's report of this working with 1418, so that i knew that i had a proper test setup. otherwise i cannot be certain of properly testing any bug fix. |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Dec 28 2005 : 6:08:19 PM
|
quote: Originally posted by ether
I can understand not writing your own. Hell, I prefer not to use any, if I can get away with it. They make the code harder to read for someone just starting out with COM.
I kind of figured you understood them a little, but I didn't want to assume you did. Just wanted to clarify why the parser may be having trouble and that it was reasonably understandable.
help is always a good thing, and is definitely welcome
COM is one of several areas that i know basically nothing about, which can make setting up a sensible test case remarkably hard. i did once start looking into COM, but it was only required for a few special cases in my program, so i eventually concluded that it was more trouble than it was worth, so i stopped, because it was making my head hurt |
zen is the art of being at one with the two'ness |
|
|
kevinsikes
Tomato Guru
USA
271 Posts |
Posted - Dec 29 2005 : 5:39:07 PM
|
I retested with build 1438 on VC6.0, and Alt+G on a smart pointer method takes me to the template<typename _IIID> class _com_ptr_t class declaration. With 1418, I have the correct choices of going to the method declaration (.tlh file) or implementation (.tli file). Here is a short self-contained smart pointer sample for you to experiment with. The sample launches a couple of Explorer windows through one of the Shell COM interfaces:
#include <windows.h>
#import <shell32.dll>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CoInitialize(NULL);
do
{
Shell32::IShellDispatchPtr p;
if (FAILED(p.CreateInstance(__uuidof(Shell32::Shell))))
{
break;
}
_variant_t v;
// explore by folder name
_bstr_t strFolder = L"c:\\\\";
v.vt = VT_BSTR;
v.bstrVal = strFolder;
p->Explore(v);
// explore by CSIDL
v.vt = VT_I4;
v.intVal = Shell32::ssfNETHOOD;
p->Explore(v);
} while(FALSE);
CoUninitialize();
return 0;
}
|
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Dec 30 2005 : 2:00:23 PM
|
thank you for the code, this way i can be sure i am running the same test you are.
something odd is going on here. at one point i am sure alt-g took me into the debug subdirectory, but i cannot reproduce this effect. i have two virtual machines setup and and comparing the results of 1418 and 1438 in VC6 with this code. i have created a new empty C++ windows project, added a "main.cpp" which only contains this code, and run it.
i am using the same project in both machines, so that is not a variable.
in both 1418 and 1438 alt-g on the function call:
p.CreateInstance(...)
offers me three different locations in the file:
C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include\\COMIP.H
it is the function call:
p->Explore(v);
that shows up the difference, reasonably enough. in 1418 i am taken to line 6013 in the file: C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include\\EXDISP.H
while in 1438 i am taken to line 51 in the file: C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include\\COMIP.H
i have tried alt-g while the program is running, paused on a break point, and that is not making any difference. i simply cannot make alt-g take me into the debug directory and these .tlh and .tli files.
"p" is the only smart pointer isn't it? am i missing something obvious here?
*ah* i have just found it. alt-g on the #define "Shell32::ssfNETHOOD" takes me to line 1024 in the file:
E:\\common_share\\code\\com_test\\Debug\\shell32.tlh
using both VA 1418 and 1438. for me this simply says:
ssfNETHOOD = 19,
so VA clearly knows about these files, but will not jump to them on the smart pointer. i can zip up the solution and email it to you if you have the time to test this. perhaps there is some project setting i have not set correctly. i have tried restarting VC6, but this is not having any effect. |
zen is the art of being at one with the two'ness |
|
|
kevinsikes
Tomato Guru
USA
271 Posts |
Posted - Dec 30 2005 : 2:49:59 PM
|
I also just noticed that you wanted COM server code, but I provided you with COM client code. Sorry about that, but it was at least enough to showcase the smart pointer Alt+G problem. If I find time this weekend, I will put together a little "Hello World" COM Server in ATL and post it for you to test with.
Have a happy New Year. |
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Dec 31 2005 : 1:06:10 PM
|
this is most kind of you, thank you |
zen is the art of being at one with the two'ness |
|
|
kevinsikes
Tomato Guru
USA
271 Posts |
Posted - Jan 03 2006 : 01:38:55 AM
|
Here is a zipfile containing a simple Hello World ATL server project and a test project that implements a smart pointer for a coclass in the server. Both were created with VC++ 6.0. Select the "use folder information" option when unzipping to recreate the directory structure. The behavior in 1418 is as follows: Alt+G on a method in the server project's header file takes you to the IDL file. It would be better to have a choice to go to the .cpp implementation. Alt+G on a smart pointer method in the test bed correctly takes you to the .tlh or .tli file for the declaration or implementation, respectively.
The behavior in 1438 is different: Alt+G on a method in the server project's header file takes you to the .cpp implementation with no choice given. Although this is arguably better than the 1418 implementation, it would still be nice to be given a choice to go to the IDL file or the .cpp file. Alt+G on a smart pointer method in the test bed takes you - hold on to your hat - nowhere. This differs from the behavior of 1438 on a different machine, which takes you to the template<typename _IIID> class _com_ptr_t definition in one of the ATL headers. There is probably a VA configuration difference between the 2 machines. Do you have a widget that takes a snapshot of the machine configuration, including VA and IDE settings?
|
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jan 03 2006 : 5:49:19 PM
|
i am getting slightly odd results here, but they seem to be changing as i open files. i wonder if the open files is the reason for the difference you are seeing between these two 1438 machines.
in an attempt to pin down what is happening i will note down what i do as i go along. load the solution in the base directory, which includes the test solution. no files are open.
from file view open "TestHello.cpp" with VA 1418 at line 14, column 14 alt-g does nothing with VA 1438 at line 14, column 14 alt-g does nothing
with VA 1418 at line 21, column 42 alt-g takes me to "CHelloWorld.h", line 30, i am given no choice. this header is now open. with VA 1438 at line 21, column 42 alt-g takes me to the beginning of the same line. a good approximation of nowhere.
now open "CHelloWorld.h" in 1438, so the machines are once again identical.
with VA 1418 at line 30, column 18 alt-g does nothing at all, i don't even move to the start of the line. with VA 1438 at line 30, column 18 alt-g takes me to "CHelloWorld.cpp" line 11, column 1, so opening the file
right, now open "CHelloWorld.cpp" in 1418, so the machines are once again identical, and take a few calming breaths.
with VA 1418 at line 30, column 18 alt-g does nothing at all, i don't even move to the start of the line. with VA 1438 at line 30, column 18 alt-g takes me to "CHelloWorld.cpp" line 11, column 1, to the open file
this is different to what you experienced.
all right, using file view open the "Hello.idl" file in both machines and then swap back to "CHelloWorld.h"
with VA 1418 at line 30, column 18 alt-g takes me to "Hello.h" line 92, column 1 this file is not even listed in "file view" with VA 1438 at line 30, column 18 alt-g takes me to "CHelloWorld.cpp" line 11, column 1, to the open file
i am not sure what to make of all of this, but it seems that both 1418 and 1438 have problems with COM servers.
i don't know of any widget to export VC6 settings, but in VA 1438 "options -> performance -> general" there is the button "export settings". all this seems to do is dump the registry keys under:
HKEY_CURRENT_USER\\Software\\Whole Tomato\ so you can do the same thing manually. however the results i have just had seem to suggest open files have as much to do with this as settings. |
zen is the art of being at one with the two'ness |
|
|
kevinsikes
Tomato Guru
USA
271 Posts |
Posted - Jan 03 2006 : 8:18:26 PM
|
Thank you for your diligent testing. Hopefully your development team will make good use of the information you gathered.quote: ...alt-g takes me to "Hello.h" line 92, column 1 this file is not even listed in "file view"
The hello.h file is created by the MIDL compiler when you build the project, so you've exposed another variable: the use of VAX before and after building a project that creates additional headers through a build step. The machine state permutations are getting difficult to keep track of, much less test: IDE configuration, VAX configuration, open files (and the order in which they are opened), header files created and recreated by MIDL; it makes one dizzy. For now, I am reverting to build 1301 when I need to work on a COM project. |
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jan 09 2006 : 6:07:48 PM
|
all right, lets re-run these tests in VA 1301 then
starting with no files open, as before. from file view open "TestHello.cpp" with VA 1301 at line 14, column 14 alt-g does nothing - save as 1418 and 1438
with VA 1301 at line 21, column 42 alt-g takes me to "Hello.idl", line 18, i am given no choice. this header is now open. this is significantly different to 1418 and 1438
now open "CHelloWorld.h"
with VA 1301 at line 30, column 18 alt-g takes me to "CHelloWorld.cpp" line 11, column 1, so opening the file. this is the same as 1438, different to 1418
i presume this is "correct"? certainly it is different to the newer builds.
i have updated
case=814
with the basic details from all of this and upped the priority a bit, since it seems this used to work. |
zen is the art of being at one with the two'ness |
|
|
kevinsikes
Tomato Guru
USA
271 Posts |
Posted - Jan 10 2006 : 9:58:50 PM
|
Does it make a difference which project is active? (There are two projects in the workspace.) Sounds like another test permutation... Thanks for bumping the priority. |
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
|
|
drazen
New Member
4 Posts |
Posted - Jan 11 2006 : 09:09:45 AM
|
Just installed latest VAX 2.1438 and tested how it works with smart pointers and it does not work correctly.
I previous version 1.1298 it worked correctly.
Tested example is: #import "msxml20.tlb" MSXML2::IXMLDOMDocument2Ptr pDOM; pDOM-> <--- this line does not show any intellysense at all
In previous version it correctly showed all methods of interface IMSDOMxxxxx. Also, pDOM. showed _com_ptr class members.
|
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jan 11 2006 : 4:02:04 PM
|
interesting. i have tried this code on 3 different test systems. on win2k in VS2003 C++ with VA 1438 and 1301 (which should be very close to your previous version) i get no suggestions for either:
pDOM. pDOM->
yet with winXP pro in VS2003 with VA 1438 i get suggestions for "pDOM." but nothing for "pDOM->"
the machines are setup the same, it is as if this is somehow OS specific. is this likely? |
zen is the art of being at one with the two'ness |
|
|
drazen
New Member
4 Posts |
Posted - Jan 12 2006 : 1:50:22 PM
|
I doubt. I have VS6, VS7 and VS8 installed and is same on all. When I register 1298 on VS6 it works ok (both suggestions for . and ->). With 1438 nothing is shown (only smart pointer declaration as written before).
I am 99% percent sure that 1298 works correctly with VS6 and VS7. 1438 makes problems with all VS's. I have WinXP Pro SP2. Any way to use 1298 dll's with 1438? |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Jan 12 2006 : 7:26:20 PM
|
i believe the problem you are seeing in 1438 is due to the newly re-written C++ parser. unfortunately i don't think you can mix and match dll's in VA. you should be able to download 1418 from here:
http://www.wholetomato.com/downloads/VA_X_Setup1418.exe
which may work correctly for you. this is the last build before the parser was re-written.
i suspect the same problem is effecting you and Kevin, so hopefully one fix with fix all of these problems. i want to do a bit more testing and see if i can reproduce what you are describing here. |
zen is the art of being at one with the two'ness |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Aug 12 2006 : 11:14:20 PM
|
Build 1532 has better support for COM smart pointers. |
|
|
|
Topic |
|