Need to call mixed-mode dll from native code.

Discussion in 'C++' started by Mike Kamzyuk, Apr 26, 2005.

  1. Mike Kamzyuk

    Mike Kamzyuk Guest

    Hello all. Basically, I need to call a mixed-mode dll's function
    (which uses managed code) from a native or mixed-mode dll function
    (which does not use managed code). I'm wondering if this could be
    accomplished and how.
    Here's the problem.

    We have a third party app (TPA) capable of loading native and
    mixed-mode dlls somehow (we don't know how). It loads our native dll
    (OND) and allows us to use our code inside the app (that is, we could
    call some of our functions).

    Now, we have a mixed-mode dll (MMD) which we built for the purpose of
    exposing OND's functionality to our .net apps.

    We built some other app (SOA) on top of MMD as a dll (the gui in the
    exe around it was easy). SOA is purely managed.

    We then decided that it would be useful if TPA was using some of SOA's
    functionality. Consequently, we decided to write another mixed-mode
    dll (AMMD) which depends on SOA, and indirectly on MMD and OND.

    Now, we got TPA to load AMMD no problem, however, AMMD is not capable
    of calling either SOA's or MMD's functions. It does not have any
    problem calling OND's functionality.

    Here's the list of possible errors I encountered while trying all
    combinations of solutions I could think of:

    1: FileNotFoundException. SOA or one of its dependencies was not
    found. When SOA is turned off, I get the same problem with MMD.
    2: Unresolved token for various functions in MMD and SOA.
    3: App hangs whenever any function from SOA or MMD is called.
    4: Removing managed calls from MMD no longer produces those errors.

    Ok...I've tried almost every possible combination of compiler switches,
    ignoring libraries, importing libraries, using directives, etc. I
    don't mind reading the MSDN articles for the fifth time, maybe I missed
    one or two....

    Does anyone know how to do this? Obviously, I'm using C++ here (except
    the managed app which is in C#, but I could live without that).

    Michael Kamzyuk
    Mike Kamzyuk, Apr 26, 2005
    1. Advertisements

  2. Mike Kamzyuk wrote:
    > Hello all. Basically, I need to call a mixed-mode dll's function
    > (which uses managed code) [...]

    Wrong newsgroup. Please find an appropriate one from the hierarchy
    of Microsoft forums: microsoft.public.*

    Victor Bazarov, Apr 26, 2005
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
  2. John J Lee
    bruno at modulix
    Dec 1, 2005
  3. Edward Loper
    Edward Loper
    Aug 7, 2007
  4. John J Lee
    John J Lee
    Aug 7, 2007
  5. Replies:

Share This Page