CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2010
    Posts
    2

    Creating a DLL that imports from existing DLL

    Hi,

    I would like to create a dll (lets call it newHD.dll) that imports functions from an existing dll (called hd.dll).

    I have been reading literature on creating dlls but most of what I have found explains how to create a single dll that exports functions, and the end-application which imports them.

    Is it possible to write in newHD.c something like:
    __declspec(dllimport) functionA();
    __declspec(dllexport) functionA();
    where functionA() belongs to hd.dll? And is then exported from newHD.dll? Or is there some other way of doing this?

    My intention is to create this newHD.dll that encompasses the functions from hd.dll and also exports a few additional functions (not included in hd.dll) which I need to use for callbacks.

    Any help would be greatly appreciated.

    Mike

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Creating a DLL that imports from existing DLL

    Though it's really possible by creating .def file of slightly different syntax, I cannot see any sense in practicing this approach. In no way this eliminates the need in hd.dll itself. So, what is your main idea behind this?
    Best regards,
    Igor

  3. #3
    Join Date
    Jun 2010
    Posts
    2

    Re: Creating a DLL that imports from existing DLL

    Thanks for the reply.

    The main reason I want to work with a dll is because I need to work with LabVIEW. I want to create a library node in LabVIEW and call the dll functions from there, but some of the functions in hd.dll take function pointers as parameters. The function pointers I need to pass point to my user-defined functions which are not defined in hd.dll.

    From what I understand I could then implement callbacks since the user-defined functions I need would be contained in newHD.dll.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Creating a DLL that imports from existing DLL

    Sorry, but I still cannot get the origins of your problem. Maybe your explanation is not clear enough. You definitely may create your newHD.dll with any functions you need. And your dll may import from any dll including hd.dll, as well as function implemented in hd.dll can accept a function pointer implemented anywhere including any other dll or main exe. Maybe your vision of the dependencies is somewhat overcomplicated?

    The main reason I want to work with a dll is because I need to work with LabVIEW.
    I don't know what LabVIEW is and how this need stipulates creation of a dll. But I definitely know what dlls are and how they work with each other. All you explanations sound totally unclear, that makes me think you build your design castle on a sand. Try to be more abstract and remove all unnecessary details (like LabVIEW) from your theory. Try to think only in categories of functions, modules, callbacks. And start from building void modules that implement only the main concept. After succeeding, with this new experience it would be much easier to get back to your particular task.
    Best regards,
    Igor

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured