Cross-Calling W/ Modules
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Cross-Calling W/ Modules

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Unhappy Cross-Calling W/ Modules

    I have a problem.. In it's simplest form I have 2 dll's (A and B) and the main exe. The main exe needs to call functions from both A, and B, and A needs to call functions from B. But B also needs to call functions from A..

    Does anyone know a way this is possible? I'm not really sure what this would be called either.

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Cross-Calling W/ Modules

    Sure, it's possible.

    Viggy

  3. #3
    Join Date
    Aug 2009
    Posts
    3

    Re: Cross-Calling W/ Modules

    But how , When I try to include the DLL's functionality I get a recursive include.. which either gives me compilation errors. Or freezes the application. Is there a way to make sure that the DLL is only loaded once and use a reference to it rather than loading it again? I have no idea how to do such a thing.

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Cross-Calling W/ Modules

    Recursive includes are a problem whether you're using a DLL or not. You can either (a) forward declare your variables in one head file, and only include the header in your source; or (b) use explicit linking (LoadLibrary) and don't include any header files.

    Viggy

  5. #5
    Join Date
    Aug 2009
    Posts
    3

    Re: Cross-Calling W/ Modules

    Thanks ^_^, I figured out that for what I am trying to do, the LoadLibrary is the best option for me =\ a little cumbersome looking in the initialization but it works, I appreciate the response ^_^.

  6. #6
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,958

    Re: Cross-Calling W/ Modules

    The main exe needs to call functions from both A, and B, and A needs to call functions from B. But B also needs to call functions from A..
    When I try to include the DLL's functionality I get a recursive include..
    Sorry, but I cannot see any relations between these two statments. Recursive include could happen because of using types but not functions (and therefore, the forward declaration will relly help). The sample would be good.

    Besides, I cannot see any reason to have two separate dlls while they both appear depending on each other.
    Last edited by Igor Vartanov; September 14th, 2009 at 07:18 AM.
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center