externe deklarationen in dll nicht bekannt (Application, externe funktion) - linker fehler



  • Hallo mal wieder,
    habe ein lustiges problem mit meiner dll. obwohl ich die <vcl.h> inkludiert habe, wirft er mir folgende Fehlermeldung beim compilieren meines dll-quelltextes:

    [Linker Fehler] Unresolved external '__fastcall Forms::TApplication::ShowException(Sysutils::Exception *)' referenced from F:\PROJECTS\LICGENDLL\SOURCE\LICGENDLL.OBJ
    

    Warum?
    Außerdem kennt er auch eine andere importierte Funktion nicht, die ich über eine .h-datei einbinde. in anderen projekten funktioniert das jedoch ohne probleme. was ist das problem?

    [Linker Fehler] Unresolved external 'GetModulePath()' referenced from F:\PROJECTS\LICGENDLL\SOURCE\LICGENDLL.OBJ
    

    zur übersicht nochmal ein bisschen code:
    LicGenDll.cpp:

    #include <vcl.h>
    #include <windows.h>
    #pragma hdrstop
    
    #define DLL_EXPORTS
    #include <Inifiles.hpp>
    #include <stdio.h>
    #include "WinExit.h"
    #include "LicGenDll.h"
    
    #pragma argsused
    int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
    {
        return 1;
    }
    
    DLL_FNC void GenerateLicense(TApplication* Application, TStringList* LicStr)
    {
        TIniFile* LicFile;
        AnsiString FileName = AnsiString(GetModulePath());
        ...
        try{
    	...
        }
        catch(Exception &exception)
        {
             Application->ShowException(&exception);
        }
    }
    

    LicGenDll.h:

    #ifndef LicGenDllH
    #define LicGenDllH
    
    #ifdef DLL_EXPORTS                      // compile dll
      #define DLL_FNC __declspec(dllexport)
    #else
      #define DLL_FNC __declspec(dllimport)    // use dll (default)
    #endif
    
    DLL_FNC void GenerateLicense(TApplication* Application, TStringList* LicStr);
    
    #endif
    

    WinExit.h:

    #ifndef __WIN_TOOLS_INCLUDE__
    #define __WIN_TOOLS_INCLUDE__
    
    extern PCHAR GetModulePath();
    
    #endif // __WIN_TOOLS_INCLUDE__
    

    Die dazugehörige Funktion ist natürlich in "WinExit.cpp" definiert.

    Freu mich wie immer auf Anregungen 😉
    Bis dahin,
    der oli


Anmelden zum Antworten