Reference to a non-shared member requires an object reference
-
Iam currently wirting a vb.net 2003 dll which links to a 3rd party com dll. I have successfuly created a com class project and registerd the dll using regasm. There is very little docs (not a surprize) and when calling the below function ProcessXMLFile("C:\myxl.xml) I get a bulid error saying "Reference to a non-shared member requires an object reference" I have found lots of refrences to this error online, but none that help in this situation. I relise the information is a little thin, not sure I have any more info but if you need more ask and I will try and provide. Thanks in advance
-
Iam currently wirting a vb.net 2003 dll which links to a 3rd party com dll. I have successfuly created a com class project and registerd the dll using regasm. There is very little docs (not a surprize) and when calling the below function ProcessXMLFile("C:\myxl.xml) I get a bulid error saying "Reference to a non-shared member requires an object reference" I have found lots of refrences to this error online, but none that help in this situation. I relise the information is a little thin, not sure I have any more info but if you need more ask and I will try and provide. Thanks in advance
Sounds to me like the ProcessXMLFile method is not static, and so requires an instance of an object to call it from. As you say, not much to go on, so I'm guessing' The other thing is, your quotes are not closed, I asume that's just a typo in your post, not in your code.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
Sounds to me like the ProcessXMLFile method is not static, and so requires an instance of an object to call it from. As you say, not much to go on, so I'm guessing' The other thing is, your quotes are not closed, I asume that's just a typo in your post, not in your code.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
Thanks, I agree that that sounds like the problem from my research. I have no clue how I would provide an instance of the oblect (I more use to borland c++ circa 1992) I found the following in the docs regarding the method HRESULT ProcessXMLFile ([in] BSTR filename, [out, retval] BSTR * errors) ; and Method ProcessXMLFile This method is used to process an XML document stored on disc, and uses the following parameters: Parameter Description BSTR filename File name and path of the XML document. BSTR * errors Output error string. Cheers
-
Thanks, I agree that that sounds like the problem from my research. I have no clue how I would provide an instance of the oblect (I more use to borland c++ circa 1992) I found the following in the docs regarding the method HRESULT ProcessXMLFile ([in] BSTR filename, [out, retval] BSTR * errors) ; and Method ProcessXMLFile This method is used to process an XML document stored on disc, and uses the following parameters: Parameter Description BSTR filename File name and path of the XML document. BSTR * errors Output error string. Cheers
Once you import your COM library, are you creating an instance of the stub class it provides ? If not, you've not got a COM object to call methods on. What's your actual code look like, is it MyCOMObjectInstance.ProcessXMLFile("whatever") Or, was the line of code exactly as you posted it ?
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
Once you import your COM library, are you creating an instance of the stub class it provides ? If not, you've not got a COM object to call methods on. What's your actual code look like, is it MyCOMObjectInstance.ProcessXMLFile("whatever") Or, was the line of code exactly as you posted it ?
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
Christian, Thanks a lot for your help, the mud becomes ever clearer. I was calling with as posted, I changed it as you suggested and it fires the method. Of course I now get a new error, but hey no one said it would be easy. Thanks again Geoff