Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Accessing a application defined DLL from sibling DLL gets no contructor available error C2512 (VC6.0).

Accessing a application defined DLL from sibling DLL gets no contructor available error C2512 (VC6.0).

Scheduled Pinned Locked Moved C / C++ / MFC
helpperformance
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vaclav_
    wrote on last edited by
    #1

    I have successfully constructed my main application using DLLs. Now I want to access one sibling DLL from another DLL. I can compile and link using forward declaration of sibling class: class OpenHR__DLL_Tabs_COM_; However, when attempting to allocate memory for the class pSecondaryTab = new OpenHR__DLL_Tabs_COM_(); I get error C2512: ...' : no appropriate default constructor available. The DLL of interest can be used by the main application without a hitch. Any constructive help as always is appreciated. Thanks Vaclav

    E A 2 Replies Last reply
    0
    • V Vaclav_

      I have successfully constructed my main application using DLLs. Now I want to access one sibling DLL from another DLL. I can compile and link using forward declaration of sibling class: class OpenHR__DLL_Tabs_COM_; However, when attempting to allocate memory for the class pSecondaryTab = new OpenHR__DLL_Tabs_COM_(); I get error C2512: ...' : no appropriate default constructor available. The DLL of interest can be used by the main application without a hitch. Any constructive help as always is appreciated. Thanks Vaclav

      E Offline
      E Offline
      Eugen Podsypalnikov
      wrote on last edited by
      #2

      Could you post the definition of OpenHR__DLL_Tabs_COM_ ? :)

      virtual void BeHappy() = 0;

      V 1 Reply Last reply
      0
      • E Eugen Podsypalnikov

        Could you post the definition of OpenHR__DLL_Tabs_COM_ ? :)

        virtual void BeHappy() = 0;

        V Offline
        V Offline
        Vaclav_
        wrote on last edited by
        #3

        Standard MFC with AFX_EXT_CLASS macro added, using MFC default constructor: class AFX_EXT_CLASS OpenHR__DLL_Tabs_COM_ : public CWnd { // Construction public: OpenHR__DLL_Tabs_COM_(); // Attributes public: ....

        E 1 Reply Last reply
        0
        • V Vaclav_

          I have successfully constructed my main application using DLLs. Now I want to access one sibling DLL from another DLL. I can compile and link using forward declaration of sibling class: class OpenHR__DLL_Tabs_COM_; However, when attempting to allocate memory for the class pSecondaryTab = new OpenHR__DLL_Tabs_COM_(); I get error C2512: ...' : no appropriate default constructor available. The DLL of interest can be used by the main application without a hitch. Any constructive help as always is appreciated. Thanks Vaclav

          A Offline
          A Offline
          Avi Berger
          wrote on last edited by
          #4

          I'm not sure about your design here. A library provides services to the program that uses it. in general, a dll will not know about, or be able to use anything from a "sibling" dll. I would suggest reconsidering your partitioning into modules so that this is not necessary and you have better encapsulation. Try for independent, service providing modules. If this is not possible, than perhaps these groupings really shouldn't be dlls. Not necessarily a recommendation, but an alternative might be to make them static libraries. If this is really necessary, then you could have the first dll dynamically link to the second. (Only one way - I don't really think you want circular references.) Under some circumstances you might do something with callbacks or passing in a object.

          Please do not read this signature.

          V 1 Reply Last reply
          0
          • A Avi Berger

            I'm not sure about your design here. A library provides services to the program that uses it. in general, a dll will not know about, or be able to use anything from a "sibling" dll. I would suggest reconsidering your partitioning into modules so that this is not necessary and you have better encapsulation. Try for independent, service providing modules. If this is not possible, than perhaps these groupings really shouldn't be dlls. Not necessarily a recommendation, but an alternative might be to make them static libraries. If this is really necessary, then you could have the first dll dynamically link to the second. (Only one way - I don't really think you want circular references.) Under some circumstances you might do something with callbacks or passing in a object.

            Please do not read this signature.

            V Offline
            V Offline
            Vaclav_
            wrote on last edited by
            #5

            Thanks Avi. I think my "problem" is that I am looking at it from user , mechanical , point of view. The DLL s are "placeholders" for property sheets. I have a main property sheet with secondary property sheet underneath. In plain talk - I have a tab control with sub-tabs. I would like to keep them in separate DLL , and so far they are. But I am trying to link them because that is the way it looks to the user. This is where I am wrong, and I need to rebuild it so they are just accessible from the main application only. They are both “connected” to the document anyway and need to communicate only with the document. Avi , I appreciate your comments, you made me think about my wrong way of approaching this. You are very helpful. Thanks Vaclav

            A 1 Reply Last reply
            0
            • V Vaclav_

              Standard MFC with AFX_EXT_CLASS macro added, using MFC default constructor: class AFX_EXT_CLASS OpenHR__DLL_Tabs_COM_ : public CWnd { // Construction public: OpenHR__DLL_Tabs_COM_(); // Attributes public: ....

              E Offline
              E Offline
              Eugen Podsypalnikov
              wrote on last edited by
              #6

              What error is coming, when you try to place OpenHR__DLL_Tabs_COM_ cTab; , please ? :)

              virtual void BeHappy() = 0;

              V 1 Reply Last reply
              0
              • E Eugen Podsypalnikov

                What error is coming, when you try to place OpenHR__DLL_Tabs_COM_ cTab; , please ? :)

                virtual void BeHappy() = 0;

                V Offline
                V Offline
                Vaclav_
                wrote on last edited by
                #7

                Eugen, when I do this OpenHR__DLL_Tabs_COM_ test; I get this error: error C2079: 'test' uses undefined class 'OpenHR__DLL_Tabs_COM_' Anyway, check the following exchange with Avi. I am using the DLLs wrong. It can be done but it is not that simple. MSDN calls it "Mutual Imports". Here is the link if you are interested: "http://msdn.microsoft.com/en-us/library/fdy23fx6(VS.71).aspx" Thanks for your help. Vaclav

                E 1 Reply Last reply
                0
                • V Vaclav_

                  Eugen, when I do this OpenHR__DLL_Tabs_COM_ test; I get this error: error C2079: 'test' uses undefined class 'OpenHR__DLL_Tabs_COM_' Anyway, check the following exchange with Avi. I am using the DLLs wrong. It can be done but it is not that simple. MSDN calls it "Mutual Imports". Here is the link if you are interested: "http://msdn.microsoft.com/en-us/library/fdy23fx6(VS.71).aspx" Thanks for your help. Vaclav

                  E Offline
                  E Offline
                  Eugen Podsypalnikov
                  wrote on last edited by
                  #8

                  I can not understand, how it can be possible, if you have placed #include "..\HeaderOfTab.h" correctly... :-D (OK, I will read your link, thank you !) For example: I have implemented the following stage :) : TOOLDLL <- EDITDLL <- APPEXE -> TOOLDLL

                  virtual void BeHappy() = 0;

                  modified on Tuesday, March 16, 2010 10:55 AM

                  A 1 Reply Last reply
                  0
                  • V Vaclav_

                    Thanks Avi. I think my "problem" is that I am looking at it from user , mechanical , point of view. The DLL s are "placeholders" for property sheets. I have a main property sheet with secondary property sheet underneath. In plain talk - I have a tab control with sub-tabs. I would like to keep them in separate DLL , and so far they are. But I am trying to link them because that is the way it looks to the user. This is where I am wrong, and I need to rebuild it so they are just accessible from the main application only. They are both “connected” to the document anyway and need to communicate only with the document. Avi , I appreciate your comments, you made me think about my wrong way of approaching this. You are very helpful. Thanks Vaclav

                    A Offline
                    A Offline
                    Avi Berger
                    wrote on last edited by
                    #9

                    You're welcome. Thank you for that link in your post to Eugen Podsypalnikov. I didn't know about that possibility.

                    Vaclav_Sal wrote:

                    They are both “connected” to the document anyway and need to communicate only with the document.

                    Sounds good to me. Being somewhat simple minded ;) , I prefer to keep things as simple and straightforward as possible. Keep in mind that you will also have to maintain what you create. I've found that locating a problem when data flow is passing between 8 components, as it does in some software I get to maintain, can sometimes be interesting. Another approach you might consider if you have to notify other windows of some action, but the document's UpdateAllViews() isn't appropriate, is to play "chain of command". Implement a custom message that is sent to the parent window for handling or rebroadcast to siblings of the originator. I've done this with mix-in classes for splitter windows to keep the panes in sync. This has let me reuse views on different tab pages with different - or no - siblings. Oh, I just noticed your reference to VC++ version 6. Are you aware that the dialect of C++ used in 6.0 is non-standard? You might want to consider shifting your development to a later version that is more standard conforming. Good luck.

                    Please do not read this signature.

                    1 Reply Last reply
                    0
                    • E Eugen Podsypalnikov

                      I can not understand, how it can be possible, if you have placed #include "..\HeaderOfTab.h" correctly... :-D (OK, I will read your link, thank you !) For example: I have implemented the following stage :) : TOOLDLL <- EDITDLL <- APPEXE -> TOOLDLL

                      virtual void BeHappy() = 0;

                      modified on Tuesday, March 16, 2010 10:55 AM

                      A Offline
                      A Offline
                      Avi Berger
                      wrote on last edited by
                      #10

                      Eugen Podsypalnikov wrote:

                      For example: I have implemented the following stage Smile : TOOLDLL <- EDITDLL <- APPEXE -> TOOLDLL

                      I believe that what Vaclav_Sal was trying was more like:

                      ----------<---------
                      

                      | |
                      EDITDLL <- APPEXE -> TOOLDLL
                      | |
                      ---------->---------

                      In other words, he wasn't linking one DLL to the other, but was trying to have them use each other by virtue of his knowing that they were both being used by the same exe.

                      Please do not read this signature.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups