DLL wird nicht gefunden

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hubert Hermanutz

    DLL wird nicht gefunden

    Hallo,

    ich möchte ein kleines Testprogramm erstellen, dass auf eine Visual C
    (Studio 6.0) DLL zugreift. Bevor ich damit beginne wollte ich die
    notwendigen Schritte, anhand eines Beispiels nachvollziehen.
    (http://www.codeproject.com/useritems...=dll%7Cimport).

    Im Beispiel wird über das Attribute DllImport gearbeitet:
    [DllImport("MyDl l.dll",...)]
    public static extern unsafe void Test(IntPtr ptr);

    Wenn ich das Beispiel ausführe, erhalte ich die Fehlermeldung:
    Eine nicht behandelte Ausnahme des Typs 'System.DllNotF oundException'
    ist in ConsoleApplicat ion1.exe aufgetreten.
    Zusätzliche Informationen: Die DLL (legacy) kann nicht geladen werden.

    Obwohl ich die DLL ins Projektverzeich nis und zusätzlich ins
    "Projektverzeic hnis\bin\", "Projektverzeic hnis\bin\Debug"
    kopiert habe.

    Wo lege ich fest in welchem Verz. die DLL sich befindet.

    Danke und Grüße
    Hubert


  • Patrick De Ridder

    #2
    Re: DLL wird nicht gefunden

    On Tue, 7 Oct 2003 11:40:12 +0200, "Hubert Hermanutz"
    <hhermanutz@kav o.de> wrote:

    [color=blue]
    >Wo lege ich fest in welchem Verz. die DLL sich befindet.[/color]

    Ich habe die Antwort nicht, aber kannst Du nicht einfach die DLL
    kopieren, statt nach die DLL suchen zu lassen? Ich habe ueberigens
    begriffen dass die zusamenarbeit swischen C++ und C# nicht immer glatt
    verlauft. Du kannst besser auf Englisch schreiben, auch wenn Dein
    Englisch nicht so gut ist.

    --
    Regards,
    Patrick.

    Comment

    • Bob Powell [MVP]

      #3
      Re: DLL wird nicht gefunden

      You have to know each of the method names and signatures that you want to
      import. I think you might have used the attribute from the example literally
      [DllImport("lega cy.dll"...)]

      Create a wrapper class...

      class myCDllWrapper
      {
      [DllImport("mydl l.dll")]
      static extern int MyMethod(
      int param1
      )


      }

      use the wrapper...

      class aClass
      {
      public int foo()
      {
      return myCDLLWrapper.M yMethod(10);
      }

      }

      Hope this helps...

      --
      Bob Powell [MVP]
      C#, System.Drawing

      September's edition of Well Formed is now available.


      Answer those GDI+ questions with the GDI+ FAQ




      "Hubert Hermanutz" <hhermanutz@kav o.de> wrote in message
      news:enJJEcLjDH A.548@TK2MSFTNG P11.phx.gbl...[color=blue]
      > Hallo,
      >
      > ich möchte ein kleines Testprogramm erstellen, dass auf eine Visual C
      > (Studio 6.0) DLL zugreift. Bevor ich damit beginne wollte ich die
      > notwendigen Schritte, anhand eines Beispiels nachvollziehen.
      > (http://www.codeproject.com/useritems...=dll%7Cimport).
      >
      > Im Beispiel wird über das Attribute DllImport gearbeitet:
      > [DllImport("MyDl l.dll",...)]
      > public static extern unsafe void Test(IntPtr ptr);
      >
      > Wenn ich das Beispiel ausführe, erhalte ich die Fehlermeldung:
      > Eine nicht behandelte Ausnahme des Typs 'System.DllNotF oundException'
      > ist in ConsoleApplicat ion1.exe aufgetreten.
      > Zusätzliche Informationen: Die DLL (legacy) kann nicht geladen werden.
      >
      > Obwohl ich die DLL ins Projektverzeich nis und zusätzlich ins
      > "Projektverzeic hnis\bin\", "Projektverzeic hnis\bin\Debug"
      > kopiert habe.
      >
      > Wo lege ich fest in welchem Verz. die DLL sich befindet.
      >
      > Danke und Grüße
      > Hubert
      >
      >[/color]


      Comment

      • Hubert Hermanutz

        #4
        Re: DLL wird nicht gefunden

        Hi Patrick,

        sorry, but i have forgotten that i should ask in english.

        I wouldn't place this dll on a specific folder. I've tried to copy the dll
        in several folders: "[program folder]", "[program folder]\bin" and "[program
        folder]\bin\debug". But i thinking NET search on other folder. Where?

        Thanks in advance,
        Hubert


        "Patrick De Ridder" <000@000.00> schrieb im Newsbeitrag
        news:dq35ov86dv 79nn4tpe696p785 b7l82one8@4ax.c om...[color=blue]
        > On Tue, 7 Oct 2003 11:40:12 +0200, "Hubert Hermanutz"
        > <hhermanutz@kav o.de> wrote:
        >
        >[color=green]
        > >Wo lege ich fest in welchem Verz. die DLL sich befindet.[/color]
        >
        > Ich habe die Antwort nicht, aber kannst Du nicht einfach die DLL
        > kopieren, statt nach die DLL suchen zu lassen? Ich habe ueberigens
        > begriffen dass die zusamenarbeit swischen C++ und C# nicht immer glatt
        > verlauft. Du kannst besser auf Englisch schreiben, auch wenn Dein
        > Englisch nicht so gut ist.
        >
        > --
        > Regards,
        > Patrick.[/color]


        Comment

        • Hubert Hermanutz

          #5
          Re: DLL wird nicht gefunden

          Hello Bob,

          sorry, but i have forgotten that i should ask in english.

          In this sample exists a wrapper class for dll accessing. But my problem is,
          that the system did not founded the dll. I've tried to copy the dll in
          several folders: "[program folder]", "[program folder]\bin" and "[program
          folder]\bin\debug". But i thinking NET search on other folder. Where?

          Thanks in advance,
          Hubert


          "Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > schrieb im Newsbeitrag
          news:OixNM9LjDH A.1716@TK2MSFTN GP12.phx.gbl...[color=blue]
          > You have to know each of the method names and signatures that you want to
          > import. I think you might have used the attribute from the example[/color]
          literally[color=blue]
          > [DllImport("lega cy.dll"...)]
          >
          > Create a wrapper class...
          >
          > class myCDllWrapper
          > {
          > [DllImport("mydl l.dll")]
          > static extern int MyMethod(
          > int param1
          > )
          >
          >
          > }
          >
          > use the wrapper...
          >
          > class aClass
          > {
          > public int foo()
          > {
          > return myCDLLWrapper.M yMethod(10);
          > }
          >
          > }
          >
          > Hope this helps...
          >
          > --
          > Bob Powell [MVP]
          > C#, System.Drawing
          >
          > September's edition of Well Formed is now available.
          > http://www.bobpowell.net/currentissue.htm
          >
          > Answer those GDI+ questions with the GDI+ FAQ
          > http://www.bobpowell.net/gdiplus_faq.htm
          >
          >
          >
          > "Hubert Hermanutz" <hhermanutz@kav o.de> wrote in message
          > news:enJJEcLjDH A.548@TK2MSFTNG P11.phx.gbl...[color=green]
          > > Hallo,
          > >
          > > ich möchte ein kleines Testprogramm erstellen, dass auf eine Visual C
          > > (Studio 6.0) DLL zugreift. Bevor ich damit beginne wollte ich die
          > > notwendigen Schritte, anhand eines Beispiels nachvollziehen.
          > > (http://www.codeproject.com/useritems...=dll%7Cimport).
          > >
          > > Im Beispiel wird über das Attribute DllImport gearbeitet:
          > > [DllImport("MyDl l.dll",...)]
          > > public static extern unsafe void Test(IntPtr ptr);
          > >
          > > Wenn ich das Beispiel ausführe, erhalte ich die Fehlermeldung:
          > > Eine nicht behandelte Ausnahme des Typs[/color][/color]
          'System.DllNotF oundException'[color=blue][color=green]
          > > ist in ConsoleApplicat ion1.exe aufgetreten.
          > > Zusätzliche Informationen: Die DLL (legacy) kann nicht geladen[/color][/color]
          werden.[color=blue][color=green]
          > >
          > > Obwohl ich die DLL ins Projektverzeich nis und zusätzlich ins
          > > "Projektverzeic hnis\bin\", "Projektverzeic hnis\bin\Debug"
          > > kopiert habe.
          > >
          > > Wo lege ich fest in welchem Verz. die DLL sich befindet.
          > >
          > > Danke und Grüße
          > > Hubert
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Bob Powell [MVP]

            #6
            Re: DLL wird nicht gefunden

            The DLL can be copied to the same place as the wrapper control or be in the
            search path somewhere.

            --
            Bob Powell [MVP]
            C#, System.Drawing

            September's edition of Well Formed is now available.


            Answer those GDI+ questions with the GDI+ FAQ




            "Hubert Hermanutz" <hhermanutz@kav o.de> wrote in message
            news:uYeNbeMjDH A.2404@TK2MSFTN GP12.phx.gbl...[color=blue]
            > Hello Bob,
            >
            > sorry, but i have forgotten that i should ask in english.
            >
            > In this sample exists a wrapper class for dll accessing. But my problem[/color]
            is,[color=blue]
            > that the system did not founded the dll. I've tried to copy the dll in
            > several folders: "[program folder]", "[program folder]\bin" and "[program
            > folder]\bin\debug". But i thinking NET search on other folder. Where?
            >
            > Thanks in advance,
            > Hubert
            >
            >
            > "Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > schrieb im Newsbeitrag
            > news:OixNM9LjDH A.1716@TK2MSFTN GP12.phx.gbl...[color=green]
            > > You have to know each of the method names and signatures that you want[/color][/color]
            to[color=blue][color=green]
            > > import. I think you might have used the attribute from the example[/color]
            > literally[color=green]
            > > [DllImport("lega cy.dll"...)]
            > >
            > > Create a wrapper class...
            > >
            > > class myCDllWrapper
            > > {
            > > [DllImport("mydl l.dll")]
            > > static extern int MyMethod(
            > > int param1
            > > )
            > >
            > >
            > > }
            > >
            > > use the wrapper...
            > >
            > > class aClass
            > > {
            > > public int foo()
            > > {
            > > return myCDLLWrapper.M yMethod(10);
            > > }
            > >
            > > }
            > >
            > > Hope this helps...
            > >
            > > --
            > > Bob Powell [MVP]
            > > C#, System.Drawing
            > >
            > > September's edition of Well Formed is now available.
            > > http://www.bobpowell.net/currentissue.htm
            > >
            > > Answer those GDI+ questions with the GDI+ FAQ
            > > http://www.bobpowell.net/gdiplus_faq.htm
            > >
            > >
            > >
            > > "Hubert Hermanutz" <hhermanutz@kav o.de> wrote in message
            > > news:enJJEcLjDH A.548@TK2MSFTNG P11.phx.gbl...[color=darkred]
            > > > Hallo,
            > > >
            > > > ich möchte ein kleines Testprogramm erstellen, dass auf eine Visual C
            > > > (Studio 6.0) DLL zugreift. Bevor ich damit beginne wollte ich die
            > > > notwendigen Schritte, anhand eines Beispiels nachvollziehen.
            > > >[/color][/color][/color]
            (http://www.codeproject.com/useritems...=dll%7Cimport).[color=blue][color=green][color=darkred]
            > > >
            > > > Im Beispiel wird über das Attribute DllImport gearbeitet:
            > > > [DllImport("MyDl l.dll",...)]
            > > > public static extern unsafe void Test(IntPtr ptr);
            > > >
            > > > Wenn ich das Beispiel ausführe, erhalte ich die Fehlermeldung:
            > > > Eine nicht behandelte Ausnahme des Typs[/color][/color]
            > 'System.DllNotF oundException'[color=green][color=darkred]
            > > > ist in ConsoleApplicat ion1.exe aufgetreten.
            > > > Zusätzliche Informationen: Die DLL (legacy) kann nicht geladen[/color][/color]
            > werden.[color=green][color=darkred]
            > > >
            > > > Obwohl ich die DLL ins Projektverzeich nis und zusätzlich ins
            > > > "Projektverzeic hnis\bin\", "Projektverzeic hnis\bin\Debug"
            > > > kopiert habe.
            > > >
            > > > Wo lege ich fest in welchem Verz. die DLL sich befindet.
            > > >
            > > > Danke und Grüße
            > > > Hubert
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Hubert Hermanutz

              #7
              Re: DLL wird nicht gefunden

              Hi,

              i could solve the problem. This DLL required MFC42d.dll and this one was not
              available on my Computer.

              Regards,
              Hubert

              "Hubert Hermanutz" <hhermanutz@kav o.de> schrieb im Newsbeitrag
              news:enJJEcLjDH A.548@TK2MSFTNG P11.phx.gbl...[color=blue]
              > Hallo,
              >
              > ich möchte ein kleines Testprogramm erstellen, dass auf eine Visual C
              > (Studio 6.0) DLL zugreift. Bevor ich damit beginne wollte ich die
              > notwendigen Schritte, anhand eines Beispiels nachvollziehen.
              > (http://www.codeproject.com/useritems...=dll%7Cimport).
              >
              > Im Beispiel wird über das Attribute DllImport gearbeitet:
              > [DllImport("MyDl l.dll",...)]
              > public static extern unsafe void Test(IntPtr ptr);
              >
              > Wenn ich das Beispiel ausführe, erhalte ich die Fehlermeldung:
              > Eine nicht behandelte Ausnahme des Typs 'System.DllNotF oundException'
              > ist in ConsoleApplicat ion1.exe aufgetreten.
              > Zusätzliche Informationen: Die DLL (legacy) kann nicht geladen werden.
              >
              > Obwohl ich die DLL ins Projektverzeich nis und zusätzlich ins
              > "Projektverzeic hnis\bin\", "Projektverzeic hnis\bin\Debug"
              > kopiert habe.
              >
              > Wo lege ich fest in welchem Verz. die DLL sich befindet.
              >
              > Danke und Grüße
              > Hubert
              >
              >[/color]


              Comment

              Working...