none
DLL Export special case RRS feed

  • Question

  • Hallo Community,

    I am coding a special Interface for Database.

    Now I have a Project which has:

    Result
    Columns
    Rows

    and another Project:
    Database
    The Database Project shall become a DLL

    and now can I first make the Result, Rows, Columns as static Libraries which I include into the DLL and also exporting the Classes inside the static Library?

    another idea were is it possible to fuse two DLLs?

    Thursday, August 8, 2019 11:01 AM

All replies

  • Hi,

    Thank you for posting here.

    >>and now can I first make the Result, Rows, Columns as static Libraries which I include into the DLL and also exporting the Classes inside the static Library?
    another idea were is it possible to fuse two DLLs?

    According to your issue I wonder if you mean you want to link static libraries with dll? If so , I suggest you need to do in order to use such library (either in .exe or .dll) is to include proper headers and link them.

    First of all, you need to know 1) where your static libraries are placed and 2) their exact names. Go to project properties and then General. Target name contains name for the output file, while Output directory indicates in which folder your .lib will be placed.And then go to Linker -> Input and then add name of your .lib to Additional dependencies. And the last thing , you also need to include headers with declarations of functions and objects, that you want to use.

    You can export data, functions, classes, or class member functions from a DLL using the __declspec(dllexport) keyword. 

    For more details about how to export C++ classes from a DLL,I suggest you could refer to the links:
    https://www.codeproject.com/Articles/28969/HowTo-Export-C-classes-from-a-DLL
    https://stackoverflow.com/questions/225432/export-all-symbols-when-creating-a-dll/731767#731767

    Best Regards,

    Jeanine Zhang

    Friday, August 9, 2019 5:18 AM
    Moderator
  • Your question is very confusing, because you aren't using normal terms.  Is it possible you mean you have a class called Result, and a class called Columns, and a class called Rows?  It's certainly possible to export classes from a DLL, although you have to make sure you're using the same version of Visual C++ as your user, so that the name decorations match up.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Friday, August 9, 2019 5:40 AM
  • I mean like that

    libDBResult.lib (static lib) (which includes Result, Column and Row)

    this one I will include to my

    DBWorker Project, which will be a DLL.

    than I will have libDBWorker.dll.

    can I export Result, Column and Row in the libDBWorker.dll?

    I mean similar like Inheretince from class

    If Class B inherits (publically) from Class A, class B will have all non-private Items from class A.

    The DLL shall have the symbols of the static lib too.

    Friday, August 9, 2019 10:05 AM
  • Yes.  The linker just looks for the entry points to export.  It doesn't care whether it came from an obj or a lib.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Saturday, August 10, 2019 5:36 AM
  • Hi,

    Have you got any updates? If your case has been solved, please help to mark answers. If not, just feel free to contact us.

    Your understanding and cooperation will be grateful.

    Best Regards,

    Jeanine Zhang

    Thursday, August 15, 2019 8:32 AM
    Moderator