locked
Suggesion about Dll RRS feed

  • Question

  • Hi all.

    I am learning about dll. but don't know which dll i should use and how to apply. i am using VC6

    What i want to do is. i need to store all my class, struct and utility function in dll and need to use that dll (those Class and struct) in Another dlls also. and finally call it from exe. planning with if in future if i have to add function for it. i make dll  and load it from exe. like a plugins. the way i can easily add more function on my app. so what i have to do for it.  looking for some guideline.

    Which dll i should use. Dynamic or static or MFC App Wizard (DLL).

    and how to make that dll. i mean when i add dll in same folder of exe file. the exe should load those dlls' class and function.

    Thanks for help.

    Amrit

    Sunday, October 21, 2012 12:36 PM

Answers

  • Yes i know that. but. i am looking for difference things.
     
    well i right now i don't know how to say exactly what i want. so i will try later in next post.
    Each module (.exe, .dll) needs to include the headers it needs in order to compile, and link to the libraries it needs in order to link. If it doesn't need them, it doesn't need them. If it does need them it does need them.
     
    If Test1.exe only uses class TestC via a TestA base class pointer (obtained from the first DLL), then the Test1.exe project does not need to include the header or link to the library of the second DLL.
     

    David Wilkinson | Visual C++ MVP
    Monday, October 22, 2012 10:02 AM

All replies

  • Hi all.
     
    I am learning about dll. but don't know which dll i should use and how to apply. i am using VC6
     
    What i want to do is. i need to store all my class, struct and utility function in dll and need to use that dll (those Class and struct) in Another dlls also. and finally call it from exe. planning with if in future if i have to add function for it. i make dll and load it from exe. like a plugins. the way i can easily add more function on my app. so what i have to do for it. looking for some guideline.
     
    Which dll i should use. Dynamic or static or MFC App Wizard (DLL).
     
    and how to make that dll. i mean when i add dll in same folder of exe file. the exe should load those dlls' class and function.
    If you want plugins that can be used with different versions of VC, then you cannot pass library objects (MFC, STL..) across the DLL boundary. In general there is no binary comaptiblity between different versions of VC.
     
    You should use a COM (or COM-like) DLL, or use a pure C interface with simple types.
     

    David Wilkinson | Visual C++ MVP
    Sunday, October 21, 2012 1:52 PM
  • hi, Thanks for reply.

    Recently i have learn from Previous post that i can't use MFC DLL from difference version. that is ok for me. but i can use difference version compiler for Compile all code and generate dll and exe. that is fine. so far i am not familiar with COM.  i have not read yet. but in the same version of dll i just want to know how exe know at run time that dll contain which function and class.

    like for example.

    1) in DLL1 i have class AA, BB, CC and it's related function. at first when i make exe that i include h file and it can be access from exe. this is compile time.

    2) in DLL2 i have class DD, EE and it's funciton. but how exe know that it come with class DD EE and it's funciton. at run time and how to use it.

    3) in DLL3 i have some extra function related to class AA, BB, and EE. and how exe know that new function added for those class. at run time.

    Thanks

    Amrit

    Sunday, October 21, 2012 2:09 PM
  • i have not read yet. but in the same version of dll i just want to know how exe know at run time that dll contain which function and class.
    In a DLL project you use a mechanism called dllexport to export classes and functions. In addition to the DLL (.dll), the project will generate an import library (.lib) which you link to your project. At run time, the stub code in this import library will load the DLL and call the functions in it.
     

    David Wilkinson | Visual C++ MVP
    Sunday, October 21, 2012 3:27 PM
  • hi Thanks for reply

    well if i may understand this is step for of when we add .h file in exe for compile. isn't it. 

    i have read some tutorial in CodeProject.  well i have test with class and function it work fine. but what i am looking for may be i could able to write. i am not good in English. sorry for that. well.... how to tell.

    ok. i would like to try once again.

    for example. what we do at first, we make dll with Export Class and function. and include that h file in project and we put dll and lib file in debug folder or release folder to compile exe file.  but i want to go little be out of box.

    supposed from the first step i made FirstTest.dll with class TestA and TestB and  we add h file in project and we compile and made Test1.Exe.

    now with the FirstTest.Dll i made SecondTest.dll with class TestC :public TestA. but SecondTest.h does not include in project to compile exe.

    now the question is here how Test1.exe read SecondTest.dll class and it's function. if is there any article and tutorial available about this. i would like to read and learn.  i think this is the most import part for me.

    it would be great if i could read any example. i could understand very fast and able to apply on my work.

    Thanks

    Amrit

    Sunday, October 21, 2012 6:00 PM
  • well if i may understand this is step for of when we add .h file in exe for compile. isn't it.
    I'm not sure I quite understand your question, but maybe this will help you:
     
    Header files are only for the compiler
     
    Import library files (.lib) are only for the linker
     
    DLL files (.dll) are only required at run time
     

    David Wilkinson | Visual C++ MVP
    Sunday, October 21, 2012 9:36 PM
  • Yes i know that. but. i am looking for difference things.

    well i right now i don't know how to say exactly what i want. so i will try later in next post.

    Thanks a lot for your help. i really appreciate.

    Amrit

    Monday, October 22, 2012 5:56 AM
  • Yes i know that. but. i am looking for difference things.
     
    well i right now i don't know how to say exactly what i want. so i will try later in next post.
    Each module (.exe, .dll) needs to include the headers it needs in order to compile, and link to the libraries it needs in order to link. If it doesn't need them, it doesn't need them. If it does need them it does need them.
     
    If Test1.exe only uses class TestC via a TestA base class pointer (obtained from the first DLL), then the Test1.exe project does not need to include the header or link to the library of the second DLL.
     

    David Wilkinson | Visual C++ MVP
    Monday, October 22, 2012 10:02 AM