Results 1 to 2 of 2

Thread: dumpcpp creates non-functional code of procedure

  1. #1
    Join Date
    Jun 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default dumpcpp creates non-functional code of procedure

    Hello community,

    I try to use a COM object in Qt using QAxContainer API. I wrote a .NET class in C# which I want to access from a Qt application. I've used the necessary attributes in MSVC to make the Class visible to COM. After building the .NET dll I converted it using tlbexp. Then I build a header and cpp file using dumpccp. Everything works fine. The class I'm trying to access has only one memberfunction "hello". this function "returns" void. The problem is, that dumpcpp creates the following function body:
    Qt Code:
    1. // member function implementation
    2. #ifndef QAX_DUMPCPP_DOCXPLUGIN_NOINLINES
    3. inline void IDocxPlugin::hello()
    4. {
    5. void qax_result;
    6. void *_a[] = {(void*)&qax_result};
    7. qt_metacall(QMetaObject::InvokeMetaMethod, 8, _a);
    8. return qax_result;
    9. }
    To copy to clipboard, switch view to plain text mode 

    Ofcourse the definition of void qax_result; causes an error. Do you know why dumpcpp produces such code?

    Here's the C# class:
    Qt Code:
    1. using System;
    2. using System.Runtime.InteropServices;
    3.  
    4. namespace DocCreator
    5. {
    6. [Guid("828ED06C-E081-43EC-9AD5-32D818A24164")]
    7. [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    8. public interface IDocxPlugin
    9. {
    10. void hello();
    11. }
    12.  
    13. [Guid("2D6E8981-9159-434B-82BB-3D1244903658")]
    14. [ClassInterface(ClassInterfaceType.None)]
    15. [ProgId("DocCreator.DocxPlugin")]
    16. public class DocxPlugin
    17. {
    18. public void hello()
    19. {
    20. System.Console.WriteLine("Hello from .NET Component");
    21. }
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 

    Here is the complete header:
    Qt Code:
    1. /****************************************************************************
    2. **
    3. ** Namespace DocxPlugin generated by dumpcpp from type library
    4. ** DocxPlugin.tlb
    5. **
    6. ****************************************************************************/
    7.  
    8. #ifndef QAX_DUMPCPP_DOCXPLUGIN_H
    9. #define QAX_DUMPCPP_DOCXPLUGIN_H
    10.  
    11. // Define this symbol to __declspec(dllexport) or __declspec(dllimport)
    12. #ifndef DOCXPLUGIN_EXPORT
    13. #define DOCXPLUGIN_EXPORT
    14. #endif
    15.  
    16. #include <qaxobject.h>
    17. #include <qaxwidget.h>
    18. #include <qdatetime.h>
    19. #include <qpixmap.h>
    20.  
    21. struct IDispatch;
    22.  
    23.  
    24. // Referenced namespace
    25. namespace mscorlib {
    26. class _Type;
    27. }
    28.  
    29.  
    30. namespace DocxPlugin {
    31.  
    32.  
    33. class DOCXPLUGIN_EXPORT IDocxPlugin : public QAxObject
    34. {
    35. public:
    36. IDocxPlugin(IDispatch *subobject = 0, QAxObject *parent = 0)
    37. : QAxObject((IUnknown*)subobject, parent)
    38. {
    39. internalRelease();
    40. }
    41.  
    42. /*
    43.   Method hello
    44.   */
    45. inline void hello();
    46.  
    47. // meta object functions
    48. static const QMetaObject staticMetaObject;
    49. virtual const QMetaObject *metaObject() const { return &staticMetaObject; }
    50. virtual void *qt_metacast(const char *);
    51. };
    52.  
    53. // Actual coclasses
    54. class DOCXPLUGIN_EXPORT DocxPlugin : public QAxObject
    55. {
    56. public:
    57. DocxPlugin(QObject *parent = 0)
    58. : QAxObject(parent)
    59. {
    60. setControl("{2d6e8981-9159-434b-82bb-3d1244903658}");
    61. }
    62.  
    63. /*
    64.   Property ToString
    65.   */
    66. inline QString ToString() const; //Returns the value of ToString
    67.  
    68. /*
    69.   Method Equals
    70.   */
    71. inline bool Equals(const QVariant& obj);
    72.  
    73. /*
    74.   Method GetHashCode
    75.   */
    76. inline int GetHashCode();
    77.  
    78. /*
    79.   Method GetType
    80.   */
    81. inline mscorlib::_Type* GetType();
    82.  
    83. // meta object functions
    84. static const QMetaObject staticMetaObject;
    85. virtual const QMetaObject *metaObject() const { return &staticMetaObject; }
    86. virtual void *qt_metacast(const char *);
    87. };
    88.  
    89. // member function implementation
    90. #ifndef QAX_DUMPCPP_DOCXPLUGIN_NOINLINES
    91. inline void IDocxPlugin::hello()
    92. {
    93. void qax_result;
    94. void *_a[] = {(void*)&qax_result};
    95. qt_metacall(QMetaObject::InvokeMetaMethod, 8, _a);
    96. return qax_result;
    97. }
    98.  
    99.  
    100. inline QString DocxPlugin::ToString() const
    101. {
    102. QVariant qax_result = property("ToString");
    103. Q_ASSERT(qax_result.isValid());
    104. return *(QString*)qax_result.constData();
    105. }
    106.  
    107. inline bool DocxPlugin::Equals(const QVariant& obj)
    108. {
    109. bool qax_result;
    110. void *_a[] = {(void*)&qax_result, (void*)&obj};
    111. qt_metacall(QMetaObject::InvokeMetaMethod, 8, _a);
    112. return qax_result;
    113. }
    114.  
    115. inline int DocxPlugin::GetHashCode()
    116. {
    117. int qax_result;
    118. void *_a[] = {(void*)&qax_result};
    119. qt_metacall(QMetaObject::InvokeMetaMethod, 9, _a);
    120. return qax_result;
    121. }
    122.  
    123. inline mscorlib::_Type* DocxPlugin::GetType()
    124. {
    125. mscorlib::_Type* qax_result = 0;
    126. qRegisterMetaType("mscorlib::_Type*", &qax_result);
    127. #ifdef QAX_DUMPCPP_MSCORLIB_H
    128. qRegisterMetaType("mscorlib::_Type", qax_result);
    129. #endif
    130. void *_a[] = {(void*)&qax_result};
    131. qt_metacall(QMetaObject::InvokeMetaMethod, 10, _a);
    132. return qax_result;
    133. }
    134.  
    135.  
    136.  
    137. #endif
    138.  
    139. }
    140.  
    141. template<>
    142. inline void *qMetaTypeCreateHelper<DocxPlugin::IDocxPlugin >(const void *t)
    143. { Q_ASSERT(!t); return new DocxPlugin::IDocxPlugin; }
    144.  
    145. template<>
    146. inline void *qMetaTypeCreateHelper<DocxPlugin::DocxPlugin >(const void *t)
    147. { Q_ASSERT(!t); return new DocxPlugin::DocxPlugin; }
    148.  
    149. #endif
    To copy to clipboard, switch view to plain text mode 

    Any help is appreciated,
    Stephan

  2. #2
    Join Date
    Jun 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: dumpcpp creates non-functional code of procedure

    Ok. I 'worked around' that problem by using a function which returns an integer value. I thought that perhaps any COM-Standard says that every function has to return a value. However the code doesn't compile. There's an unknown type mscorlib::_Type. I don't know what that is. Any suggestions? mscorlib is .NET-Stuff, isn't it. But that's exactly what I want to wrap with this code. Any suggestions?

    Stephan

Similar Threads

  1. Application is fully functional ONLY on my laptop
    By juracist in forum Installation and Deployment
    Replies: 17
    Last Post: 24th June 2012, 23:58
  2. Using ActiveX controls and dumpcpp
    By eli in forum Qt Programming
    Replies: 11
    Last Post: 1st August 2011, 07:07
  3. Need to show a menu item with disabled look but functional
    By lalesculiviu in forum Qt Programming
    Replies: 4
    Last Post: 21st October 2009, 15:16
  4. Loading DLL that creates GUI.
    By The Storm in forum Qt Programming
    Replies: 11
    Last Post: 3rd December 2008, 18:19
  5. Integrating dumpcpp in VS build
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 15th October 2007, 17:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.