Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. Prozedureinsprungspunkt nicht gefunden

Prozedureinsprungspunkt nicht gefunden

Scheduled Pinned Locked Moved German
4 Posts 3 Posters 8.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MaPet
    wrote on 2 May 2012, 11:20 last edited by
    #1

    hy
    ich habe eine c++ win32 app(mit VS2010 geschieben) und eine gui, die ich mit qt geschieben haben als dll.
    ich möchte nun die dll von meiner win32 app ausführen und bekomme folgende fehlermeldung.
    "der prozedureinsprungspunkt ??0QtStatusBar@@QAE@PAVQWidget@@@Z" wurde in der DLL QtGuid4.dll nicht gefunden!

    alle notwendigen dlls liegen direkt neben meiner exe file.
    so rufe ich meine dll auf:

    @typedef double (BinaryFunction_t) (int, char) ;

    int CallMyDLL (void)
    {
    BinaryFunction_t AddNumbers ;
    double result ;
    bool fFreeResult ;

    // DLL Datei laden
    HINSTANCE hinstLib = LoadLibrary (TEXT("C:\\workspace\\TestProject\\gui3\\Debug\\gui1.dll"));
    
    if (hinstLib != NULL)
    {
        // Die Einsprungadresse abfragen
        AddNumbers = (BinaryFunction_t) GetProcAddress (hinstLib, "main") ;
    
        // Die Funktion aufrufen
        if ( AddNumbers != NULL )
            result = (*AddNumbers) (1, "this is a test") ;
    
        // Die DLL-Datei wieder entladen
        fFreeResult = FreeLibrary (hinstLib) ;
    } 
    
    return 0 ;
    

    }

    int _tmain(int argc, _TCHAR* argv[])
    {
    CallMyDLL();
    return 0;
    }@

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on 3 May 2012, 07:21 last edited by
      #2

      Benötigte Dlls werden nicht bei einer zu ladenden Dll gesucht, sondern bei der exe, im windows system und im suchpfad.

      Unter windows gibt es einen API aufruf umn das zu erweitern: SetDllDirectoryW: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686203(v=vs.85).aspx

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MaPet
        wrote on 3 May 2012, 07:35 last edited by
        #3

        hallo,
        [quote author="MaPet" date="1335957610"]hy
        alle notwendigen dlls liegen direkt neben meiner exe file.
        [/quote]

        oder meintest du, dass ich den QtSDK lib folder mit SetDllDirectoryW angeben soll?

        1 Reply Last reply
        0
        • F Offline
          F Offline
          franku
          wrote on 7 Jul 2012, 08:27 last edited by
          #4

          Hallo, ich zeige mal zwei minimale Projekte, die zusammen bei mir laufen. Vielleicht hilft das weiter, auch wenn ich noch nicht genau weiß, was Du vorhast. Ich habe allerdings alles mit MinGW/QtCreator gebaut, ohne VS zu verwenden.

          Ich habe einfach ein MainWindow mit dem Designer erstellt und das in der dll gestartet. Die nicht-Qt App lädt die dll genauso, wie es oben steht und startet mit dem AddNumbers() das MainWindow.

          Im Debug-Verzeichnis von dll-test1 stehen bei mir folgende Dateien:

          • dll-test1.exe (die nicht Qt-App)
          • gui1.dll (manuell kopiert aus dem Verzeichnis des dll- debug build)
          • libgcc_s_sjlj-1.dll (manuell kopiert aus mingw64)
          • main.o (ist nicht mehr wichtig)
          • QtCored4.dll (manuell kopiert aus der Qt-Toolchain)
          • QtGuid4.dll (manuell kopiert aus der Qt-Toolchain)

          1.) Für die DLL:

          gui1.pro
          @TARGET = gui1
          TEMPLATE = lib

          DEFINES += GUI1_LIBRARY

          SOURCES += gui1.cpp

          HEADERS += gui1.h
          ui_mainwindow.h

          FORMS +=
          mainwindow.ui
          @

          gui1.h
          @#ifndef GUI1_H
          #define GUI1_H

          #include <QtCore/qglobal.h>

          #if defined(GUI1_LIBRARY)

          define GUI1SHARED_EXPORT Q_DECL_EXPORT

          #else

          define GUI1SHARED_EXPORT Q_DECL_IMPORT

          #endif

          GUI1SHARED_EXPORT int main(int argc, char* argv[]);

          #endif // GUI1_H
          @

          gui1.cpp
          @#include "gui1.h"
          #include "ui_mainwindow.h"

          #include <QApplication>

          int main(int argc, char *argv[])
          {
          QApplication app(argc, argv);

          QMainWindow window;
          Ui::MainWindow ui;
          
          ui.setupUi(&window);
          window.show();
          
          app.exec&#40;&#41;;
          

          }
          @

          2.) Für die (nicht-qt) Application:

          dll-test1.pro

          @TEMPLATE = app
          CONFIG += console
          CONFIG -= qt

          SOURCES += main.cpp
          @

          dll-test1.cpp
          @#include <windows.h>
          #include <iostream>

          using namespace std;

          typedef double (BinaryFunction_t) (int, char) ;

          int CallMyDLL (void)
          {
          BinaryFunction_t AddNumbers ;
          double result ;
          bool fFreeResult ;

          // DLL Datei laden
          HINSTANCE hinstLib = LoadLibrary (TEXT("gui1.dll"));
          
          if (hinstLib != NULL)
          {
              // Die Einsprungadresse abfragen
              AddNumbers = (BinaryFunction_t) GetProcAddress (hinstLib, "main") ;
          
              // Die Funktion aufrufen
              if ( AddNumbers != NULL )
                  result = (*AddNumbers) (1, (char*)"this is a test") ;
          
              // Die DLL-Datei wieder entladen
              fFreeResult = FreeLibrary (hinstLib) ;
          } else {
              cout << "Could not load dll" << endl;
          }
          
          return 0 ;
          

          }

          int main(int argc, char *argv[])
          {
          CallMyDLL();
          return 0;
          }
          @

          This, Jen, is the internet.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved