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. DLL basic question

DLL basic question

Scheduled Pinned Locked Moved C / C++ / MFC
19 Posts 5 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.
  • G grassrootkit

    When I export a class in a DLL, I'm not actually dealing with dllmain or those DLL_PROCESS_ATTACH , DETACH thing. I just simply export it as a class. Then how things work without implementing these?

    L Offline
    L Offline
    led mike
    wrote on last edited by
    #2

    grassrootkit wrote:

    Then how things work without implementing these?

    That depends. If, for example, your DLL was using COM and your host wasn't, it wouldn't work if you didn't handle the thread attach event and initialize COM. All the COM calls would fail because that's how COM works. So it depends on what you are doing in your DLL. In other words all DLL's are not equal.

    G 2 Replies Last reply
    0
    • L led mike

      grassrootkit wrote:

      Then how things work without implementing these?

      That depends. If, for example, your DLL was using COM and your host wasn't, it wouldn't work if you didn't handle the thread attach event and initialize COM. All the COM calls would fail because that's how COM works. So it depends on what you are doing in your DLL. In other words all DLL's are not equal.

      G Offline
      G Offline
      grassrootkit
      wrote on last edited by
      #3

      So it should concern us only if we are dealing with COM?

      L 1 Reply Last reply
      0
      • G grassrootkit

        So it should concern us only if we are dealing with COM?

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #4

        Really? That's your interpretation of my post? good luck

        G C 2 Replies Last reply
        0
        • L led mike

          Really? That's your interpretation of my post? good luck

          G Offline
          G Offline
          grassrootkit
          wrote on last edited by
          #5

          your DLL was using COM and your host wasn't, it wouldn't work if you didn't handle the thread attach event and initialize COM. You mean "if my DLL is a COM dll" and the hosting application not using COM?:confused: I'm really not able to follow you. Can you explain a bit more without taking out the stick?

          L 1 Reply Last reply
          0
          • G grassrootkit

            When I export a class in a DLL, I'm not actually dealing with dllmain or those DLL_PROCESS_ATTACH , DETACH thing. I just simply export it as a class. Then how things work without implementing these?

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #6

            The functions are always called. But for a plain dll (not COM), you don't have to do anything in them. However, you could do some initialization and clean-up stuff but that's up to you.

            Cédric Moonen Software developer
            Charting control [v1.5] OpenGL game tutorial in C++

            G 1 Reply Last reply
            0
            • G grassrootkit

              your DLL was using COM and your host wasn't, it wouldn't work if you didn't handle the thread attach event and initialize COM. You mean "if my DLL is a COM dll" and the hosting application not using COM?:confused: I'm really not able to follow you. Can you explain a bit more without taking out the stick?

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #7

              grassrootkit wrote:

              Can you explain a bit more

              Um I already did explain more, maybe you missed those parts?

              led mike wrote:

              That depends.

              led mike wrote:

              If, for example, your DLL was using COM

              led mike wrote:

              because that's how COM works.

              led mike wrote:

              **

              So it depends on what you are doing in your DLL.

              **

              led mike wrote:

              In other words all DLL's are not equal.

              By the way, that's not a stick, that's just quoting what I already posted.

              G 1 Reply Last reply
              0
              • L led mike

                Really? That's your interpretation of my post? good luck

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #8

                led mike wrote:

                Really? That's your interpretation of my post?

                Wonderful. :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                G 1 Reply Last reply
                0
                • C Cedric Moonen

                  The functions are always called. But for a plain dll (not COM), you don't have to do anything in them. However, you could do some initialization and clean-up stuff but that's up to you.

                  Cédric Moonen Software developer
                  Charting control [v1.5] OpenGL game tutorial in C++

                  G Offline
                  G Offline
                  grassrootkit
                  wrote on last edited by
                  #9

                  Thanks! This is what I asked. Excellent. Straight forward & a neat reply.

                  modified on Wednesday, April 1, 2009 2:36 PM

                  1 Reply Last reply
                  0
                  • L led mike

                    grassrootkit wrote:

                    Can you explain a bit more

                    Um I already did explain more, maybe you missed those parts?

                    led mike wrote:

                    That depends.

                    led mike wrote:

                    If, for example, your DLL was using COM

                    led mike wrote:

                    because that's how COM works.

                    led mike wrote:

                    **

                    So it depends on what you are doing in your DLL.

                    **

                    led mike wrote:

                    In other words all DLL's are not equal.

                    By the way, that's not a stick, that's just quoting what I already posted.

                    G Offline
                    G Offline
                    grassrootkit
                    wrote on last edited by
                    #10

                    led mike wrote:

                    In other words all DLL's are not equal.

                    I just asked I should take care of dllmain when I'm writing a simple C++ exported class. And you replied with reference to COM! That was little vague or may be I couldn't follow your language. That's why I asked the question again but anyway Cedric moonen got it quite right.

                    L 1 Reply Last reply
                    0
                    • C CPallini

                      led mike wrote:

                      Really? That's your interpretation of my post?

                      Wonderful. :-D

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      G Offline
                      G Offline
                      grassrootkit
                      wrote on last edited by
                      #11

                      CPallini wrote:

                      Wonderful.

                      Q:When I export a class in a DLL, I'm not actually dealing with dllmain or those DLL_PROCESS_ATTACH , DETACH thing. I just simply export it as a class. Then how things work without implementing these? A:That depends. If, for example, your DLL was using COM and your host wasn't, it wouldn't work if you didn't handle the thread attach event and initialize COM. All the COM calls would fail because that's how COM works. So it depends on what you are doing in your DLL. In other words all DLL's are not equal. Q:So it should concern us only if we are dealing with COM? *:Really? That's your interpretation of my post? What's there for you to wonder so much? Don't expect everybody to know everything. I haven't worked with COM. That's why I asked the question that way. I found his reply a bit rude. Now yours is a bit worse. If Cedric Moonen can get question my right why can't you?

                      C 1 Reply Last reply
                      0
                      • L led mike

                        grassrootkit wrote:

                        Then how things work without implementing these?

                        That depends. If, for example, your DLL was using COM and your host wasn't, it wouldn't work if you didn't handle the thread attach event and initialize COM. All the COM calls would fail because that's how COM works. So it depends on what you are doing in your DLL. In other words all DLL's are not equal.

                        G Offline
                        G Offline
                        grassrootkit
                        wrote on last edited by
                        #12

                        So it should concern us only if we are dealing with COM? May be I should have rephrased that as: "We don't need to worry if we are just exporting a class."

                        1 Reply Last reply
                        0
                        • G grassrootkit

                          CPallini wrote:

                          Wonderful.

                          Q:When I export a class in a DLL, I'm not actually dealing with dllmain or those DLL_PROCESS_ATTACH , DETACH thing. I just simply export it as a class. Then how things work without implementing these? A:That depends. If, for example, your DLL was using COM and your host wasn't, it wouldn't work if you didn't handle the thread attach event and initialize COM. All the COM calls would fail because that's how COM works. So it depends on what you are doing in your DLL. In other words all DLL's are not equal. Q:So it should concern us only if we are dealing with COM? *:Really? That's your interpretation of my post? What's there for you to wonder so much? Don't expect everybody to know everything. I haven't worked with COM. That's why I asked the question that way. I found his reply a bit rude. Now yours is a bit worse. If Cedric Moonen can get question my right why can't you?

                          C Offline
                          C Offline
                          CPallini
                          wrote on last edited by
                          #13

                          He made an example, you didn't understand it was just an example. For a better understanding see [^]. :)

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          1 Reply Last reply
                          0
                          • G grassrootkit

                            led mike wrote:

                            In other words all DLL's are not equal.

                            I just asked I should take care of dllmain when I'm writing a simple C++ exported class. And you replied with reference to COM! That was little vague or may be I couldn't follow your language. That's why I asked the question again but anyway Cedric moonen got it quite right.

                            L Offline
                            L Offline
                            led mike
                            wrote on last edited by
                            #14

                            grassrootkit wrote:

                            Cedric moonen got it quite right.

                            Cedric Moonen wrote:

                            But for a plain dll (not COM), you don't have to do anything in them

                            No, that is not correct. In a "not COM" DLL you don't have to initialize COM, but you may need to do something else, DEPENDING ON WHAT THE FRACK YOU ARE DOING IN YOUR DLL!!!! There is no way to make that point more clear. If you can't understand it, you should change careers. BTW, I find your refusal to read what I post in reply to your question, very rude. Therefore I don't give a rats ass what you think is rude. Get it? Got it? Good.

                            B C 2 Replies Last reply
                            0
                            • L led mike

                              grassrootkit wrote:

                              Cedric moonen got it quite right.

                              Cedric Moonen wrote:

                              But for a plain dll (not COM), you don't have to do anything in them

                              No, that is not correct. In a "not COM" DLL you don't have to initialize COM, but you may need to do something else, DEPENDING ON WHAT THE FRACK YOU ARE DOING IN YOUR DLL!!!! There is no way to make that point more clear. If you can't understand it, you should change careers. BTW, I find your refusal to read what I post in reply to your question, very rude. Therefore I don't give a rats ass what you think is rude. Get it? Got it? Good.

                              B Offline
                              B Offline
                              bulg
                              wrote on last edited by
                              #15

                              Having a bad day?

                              L C 2 Replies Last reply
                              0
                              • B bulg

                                Having a bad day?

                                L Offline
                                L Offline
                                led mike
                                wrote on last edited by
                                #16

                                Was I talking to you? Well now I am so fuck off asshole

                                1 Reply Last reply
                                0
                                • B bulg

                                  Having a bad day?

                                  C Offline
                                  C Offline
                                  CPallini
                                  wrote on last edited by
                                  #17

                                  Actually he was pretty nice today. Never heard about 'Terrible Led Mike' before? :)

                                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                  [My articles]

                                  1 Reply Last reply
                                  0
                                  • L led mike

                                    grassrootkit wrote:

                                    Cedric moonen got it quite right.

                                    Cedric Moonen wrote:

                                    But for a plain dll (not COM), you don't have to do anything in them

                                    No, that is not correct. In a "not COM" DLL you don't have to initialize COM, but you may need to do something else, DEPENDING ON WHAT THE FRACK YOU ARE DOING IN YOUR DLL!!!! There is no way to make that point more clear. If you can't understand it, you should change careers. BTW, I find your refusal to read what I post in reply to your question, very rude. Therefore I don't give a rats ass what you think is rude. Get it? Got it? Good.

                                    C Offline
                                    C Offline
                                    Cedric Moonen
                                    wrote on last edited by
                                    #18

                                    led mike wrote:

                                    No, that is not correct. In a "not COM" DLL you don't have to initialize COM, but you may need to do something else, DEPENDING ON WHAT THE FRACK YOU ARE DOING IN YOUR DLL!!!!

                                    That's what I was saying in my second sentence: you might want to initialize stuff depending on what your dll is doing :)

                                    Cédric Moonen Software developer
                                    Charting control [v1.5] OpenGL game tutorial in C++

                                    L 1 Reply Last reply
                                    0
                                    • C Cedric Moonen

                                      led mike wrote:

                                      No, that is not correct. In a "not COM" DLL you don't have to initialize COM, but you may need to do something else, DEPENDING ON WHAT THE FRACK YOU ARE DOING IN YOUR DLL!!!!

                                      That's what I was saying in my second sentence: you might want to initialize stuff depending on what your dll is doing :)

                                      Cédric Moonen Software developer
                                      Charting control [v1.5] OpenGL game tutorial in C++

                                      L Offline
                                      L Offline
                                      led mike
                                      wrote on last edited by
                                      #19

                                      I know that but the monkey can't seem to understand it. Changing subjects, the voting in this thread is a perfect example of how off it can be, my actual (and correct) answer to the question get's no votes but my post flaming someone else get's a '5' :laugh: :laugh:

                                      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