Dll einbinden
-
Hallo
Ich hoffe ich bin im richtigen Forum. Aber ich wollte eine Dll in mein VCL Projekt einbinden und hab das Beispiel aus den BCB-FAQ´s übernommen. Ich bekomme aber einen Fehler: "undefiniertes Symbol 'DllTest'"
hier mein Code//Header #ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // Von der IDE verwaltete Komponenten TButton *Button1; void __fastcall Button1Click(TObject *Sender); private: // Anwender-Deklarationen public: // Anwender-Deklarationen __fastcall TForm1(TComponent* Owner); }; //---------------------------------------------------------------------------- class TDLLTest { private: typedef int (DLLFUNCTION)(int, int); DLLFUNCTION *pDllFunction; public: TDLLTest(); void CallDllFunction(int iTest1, int iTest2); }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif //CPP Datei#include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- TDLLTest::TDLLTest() { HINSTANCE hInstance; hInstance = ::LoadLibrary("Form1.dll"); pDllFunction = (DLLFUNCTION*)::GetProcAddress((HMODULE)hInstance, "Anzeigen"); } void TDLLTest::CallDllFunction(int iTest1, int iTest2) { int iResult; if (pDllFunction) iResult = (*pDllFunction)(iTest1, iTest2); } //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { TDLLTest DllTest; DLLTest.CallDllFunktion(); }
was mach ich da noch falsch?
Danke schonmal
Matthias
-
Hallo Mati,
ich kenne das Beispiel aus FAQ nicht. Mir ist allerdings neu dass es möglich ist eine Klasse mitTDLLTest DllTest;
ins Leben zu holen. Ist das eventuell bereits dein Problem?
Mir ist das nur so bekannt:
class TErrorText : public TComponent // Aus dem H-File von TErroroText TErrorText* ErrTxt; // Aus dem H-File von Hauptform ErrTxt = new TErrorText(HauptForm);
Evi48