Mixed DLL Loading Problem??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mali Guven

    Mixed DLL Loading Problem??

    Hello,

    I have a native DLL (written in C) which is supposed to call a managed DLL
    (was written in C#, and an entry point was injected modifying the ildasm'd
    code).

    The exectuable calls the native DLL but the native DLL fails to load the
    managed DLL. The paper that addresses the 'mixed DLL problem' below does not
    offer any understandable workaround.


    Does anybody who has came across this have a better understanding of the
    possible resolutions of the mixed dll problem? I am very close to totally
    abondaning working with mixed DLLs (wasting hundreds of manhours).

    Regards,
    Mali


  • Willy Denoyette [MVP]

    #2
    Re: Mixed DLL Loading Problem??


    "Mali Guven" <guvenma@hotmai l.com> wrote in message
    news:dukcmc$r6g $1@eeyore.INS.c wru.edu...
    | Hello,
    |
    | I have a native DLL (written in C) which is supposed to call a managed DLL
    | (was written in C#, and an entry point was injected modifying the ildasm'd
    | code).
    |
    | The exectuable calls the native DLL but the native DLL fails to load the
    | managed DLL. The paper that addresses the 'mixed DLL problem' below does
    not
    | offer any understandable workaround.
    |

    |
    | Does anybody who has came across this have a better understanding of the
    | possible resolutions of the mixed dll problem? I am very close to totally
    | abondaning working with mixed DLLs (wasting hundreds of manhours).
    |
    | Regards,
    | Mali
    |
    |

    If I understand you correctly, you are calling a managed function from pure
    unmanaged C code, right?
    If that's the case, this has nothing to do with the mixed mode issue, "mixed
    mode" means a single DLL that contains both managed(IL) and native code. You
    are calling an "entry point" in a C# managed assembly, that you have created
    by tweaking the IL and re-assembling, I guess you know that this is not a
    supported scenario and extremely error prone. All you can do is use a
    supported interop mechanism, that is, a real "mixed mode DLL", that calls
    into C#, without resorting to a dirty hack, or use COM interop.

    Willy.


    Comment

    • Mali Guven

      #3
      Re: Mixed DLL Loading Problem??


      Thanks for the clarification. I will see what it would take to switch to the
      real *mixed mode* (a DLL with both native and managed code). In my case, COM
      interop is not an option due to speed concerns.

      Mali


      "Willy Denoyette [MVP]" <willy.denoyett e@telenet.be> wrote in message
      news:OXyM8ygQGH A.2692@TK2MSFTN GP14.phx.gbl...[color=blue]
      >
      > "Mali Guven" <guvenma@hotmai l.com> wrote in message
      > news:dukcmc$r6g $1@eeyore.INS.c wru.edu...
      > | Hello,
      > |
      > | I have a native DLL (written in C) which is supposed to call a managed[/color]
      DLL[color=blue]
      > | (was written in C#, and an entry point was injected modifying the[/color]
      ildasm'd[color=blue]
      > | code).
      > |
      > | The exectuable calls the native DLL but the native DLL fails to load the
      > | managed DLL. The paper that addresses the 'mixed DLL problem' below does
      > not
      > | offer any understandable workaround.
      > |
      >[/color]
      http://msdn.microsoft.com/library/de...ingProblem.asp[color=blue]
      > |
      > | Does anybody who has came across this have a better understanding of the
      > | possible resolutions of the mixed dll problem? I am very close to[/color]
      totally[color=blue]
      > | abondaning working with mixed DLLs (wasting hundreds of manhours).
      > |
      > | Regards,
      > | Mali
      > |
      > |
      >
      > If I understand you correctly, you are calling a managed function from[/color]
      pure[color=blue]
      > unmanaged C code, right?
      > If that's the case, this has nothing to do with the mixed mode issue,[/color]
      "mixed[color=blue]
      > mode" means a single DLL that contains both managed(IL) and native code.[/color]
      You[color=blue]
      > are calling an "entry point" in a C# managed assembly, that you have[/color]
      created[color=blue]
      > by tweaking the IL and re-assembling, I guess you know that this is not a
      > supported scenario and extremely error prone. All you can do is use a
      > supported interop mechanism, that is, a real "mixed mode DLL", that calls
      > into C#, without resorting to a dirty hack, or use COM interop.
      >
      > Willy.
      >
      >[/color]


      Comment

      • Willy Denoyette [MVP]

        #4
        Re: Mixed DLL Loading Problem??

        Speed should not be a concern, COM interop can just be as fast as any other
        interop mechanism (when done correctly). Whenever you transition from
        unmanaged to unmanaged and back you'll incur some overhead, if this is not
        wanted, you should not use managed code (or unmanaged for that matter).

        Willy.


        "Mali Guven" <guvenma@hotmai l.com> wrote in message
        news:dul5b2$epu $1@eeyore.INS.c wru.edu...
        |
        | Thanks for the clarification. I will see what it would take to switch to
        the
        | real *mixed mode* (a DLL with both native and managed code). In my case,
        COM
        | interop is not an option due to speed concerns.
        |
        | Mali
        |
        |
        | "Willy Denoyette [MVP]" <willy.denoyett e@telenet.be> wrote in message
        | news:OXyM8ygQGH A.2692@TK2MSFTN GP14.phx.gbl...
        | >
        | > "Mali Guven" <guvenma@hotmai l.com> wrote in message
        | > news:dukcmc$r6g $1@eeyore.INS.c wru.edu...
        | > | Hello,
        | > |
        | > | I have a native DLL (written in C) which is supposed to call a managed
        | DLL
        | > | (was written in C#, and an entry point was injected modifying the
        | ildasm'd
        | > | code).
        | > |
        | > | The exectuable calls the native DLL but the native DLL fails to load
        the
        | > | managed DLL. The paper that addresses the 'mixed DLL problem' below
        does
        | > not
        | > | offer any understandable workaround.
        | > |
        | >
        |

        | > |
        | > | Does anybody who has came across this have a better understanding of
        the
        | > | possible resolutions of the mixed dll problem? I am very close to
        | totally
        | > | abondaning working with mixed DLLs (wasting hundreds of manhours).
        | > |
        | > | Regards,
        | > | Mali
        | > |
        | > |
        | >
        | > If I understand you correctly, you are calling a managed function from
        | pure
        | > unmanaged C code, right?
        | > If that's the case, this has nothing to do with the mixed mode issue,
        | "mixed
        | > mode" means a single DLL that contains both managed(IL) and native code.
        | You
        | > are calling an "entry point" in a C# managed assembly, that you have
        | created
        | > by tweaking the IL and re-assembling, I guess you know that this is not
        a
        | > supported scenario and extremely error prone. All you can do is use a
        | > supported interop mechanism, that is, a real "mixed mode DLL", that
        calls
        | > into C#, without resorting to a dirty hack, or use COM interop.
        | >
        | > Willy.
        | >
        | >
        |
        |


        Comment

        Working...