Problem mit laden von DLL's
-
Hallo!
Ich habe ein Problem!
Wenn ich in Borland 6 Enterprise mit dem dll-Wizard eine dll erstelle!und diese dann in einem neuen Projekt Lade und in diesem Projekt 'Build with runtime Packages' deaktiviere, dann funktioniert das prog auch (also es läd die dll und läd die funktion aus der dll), ABER wenn ich es auf einen anderen Computer öffne (ohne Borland und anderen c++ Builder), dann spuckt er mir aus: vcl60.bpl & rtl60.bpl wurden nicht gefunden/fehlen! Dabei habe ich diese mit eingebunden (NUR im Projekt nicht im DLL-Project)
Nun habe ich den Verdacht, dass ich in dem DLL-Projekt AUCH 'Build with runtime Packages' deaktivieren muss, aber wenn ich das mache, dann kommen Fehler in der 'UNIT1.OBJ' Ich habe keine Ahnung warum!
Nun, habt ihr eine IDEE, wie ich diese Problem lösen kann?
-
Wenn deine DLL VCL-Funktionen nutzt muss diese - genau wie das Projekt selbst - statisch gelinkt werden. http://www.marquardtnet.info/cecke/quickies.1/1_quicky_16.html
-
Ja!
Ich habe sowohl die EXE als auch die DLL versucht zu verlinken, bei der EXE ist das garkein Problem, aber bei der DLL schon!
Also ich habe folgenden Code in der dll (c++\Multi Threaded\Use VCL habe ich in dem DLL-Wizard Aktiviert) und habe das Projekt statisch gelinkt:
//--------------------------------------------------------------------------- #include <vcl.h> #include <windows.h> #pragma hdrstop //--------------------------------------------------------------------------- // Important note about DLL memory management when your DLL uses the // static version of the RunTime Library: // // If your DLL exports any functions that pass String objects (or structs/ // classes containing nested Strings) as parameter or function results, // you will need to add the library MEMMGR.LIB to both the DLL project and // any other projects that use the DLL. You will also need to use MEMMGR.LIB // if any other projects which use the DLL will be performing new or delete // operations on any non-TObject-derived classes which are exported from the // DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling // EXE's to use the BORLNDMM.DLL as their memory manager. In these cases, // the file BORLNDMM.DLL should be deployed along with your DLL. // // To avoid using BORLNDMM.DLL, pass string information using "char *" or // ShortString parameters. // // If your DLL uses the dynamic version of the RTL, you do not need to // explicitly add MEMMGR.LIB as this will be done implicitly for you //--------------------------------------------------------------------------- #pragma argsused int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved) { return 1; } extern "C" __declspec(dllexport) Sshot(char *pfad) { unsigned char* pBuffer; int result, palette_size; Graphics::TBitmap *Image = new Graphics::TBitmap(); HDC window = GetWindowDC(NULL); HDC HScreenDC = GetDC(0); Image->Handle = CreateCompatibleBitmap(HScreenDC, Screen->Width, Screen->Height); result = GetDeviceCaps(HScreenDC, RASTERCAPS); if (result & RC_PALETTE) { palette_size = GetDeviceCaps(HScreenDC, SIZEPALETTE); if (palette_size == 256) { const size_t size = sizeof(LOGPALETTE) + 255 * sizeof(PALETTEENTRY); pBuffer = new unsigned char[size]; LPLOGPALETTE palette = reinterpret_cast<LPLOGPALETTE>(pBuffer); palette->palVersion = 0x300; palette->palNumEntries = 256; GetSystemPaletteEntries(HScreenDC, 0, 256, palette->palPalEntry); Image->Palette = CreatePalette(palette); delete [] pBuffer; } } ReleaseDC(0, HScreenDC); BitBlt(Image->Canvas->Handle, 0, 0, Image->Width, Image->Height, window, 0, 0, SRCCOPY); Image->SaveToFile(pfad); } //---------------------------------------------------------------------------Bei diesem Code treten bei mir folgende Fehler auf:
[Linker Error] Unresolved external 'Graphics::TBitmap::' referenced from C:\UNIT1.OBJ
[Linker Error] Unresolved external '__fastcall Graphics::TBitmap::TBitmap()' referenced from C:\UNIT1.OBJ
[Linker Error] Unresolved external '__fastcall Forms::TScreen::GetHeight()' referenced from C:\UNIT1.OBJ
[Linker Error] Unresolved external 'Forms::Screen' referenced from C:\UNIT1.OBJ
[Linker Error] Unresolved external '__fastcall Forms::TScreen::GetWidth()' referenced from C:\UNIT1.OBJ
[Linker Error] Unresolved external '__fastcall Graphics::TBitmap::SetHandle(unsigned int)' referenced from
C:\PROGRAMME\BORLAND\CBUILDER6\LIB\RELEASE\VCLE.LIB|_t_Graph[Linker Error] Unresolved external '__fastcall Graphics::TBitmap::GetCanvas()' referenced from C:\UNIT1.OBJ
[Linker Error] Unresolved external '__fastcall Graphics::TCanvas::GetHandle()' referenced from C:\UNIT1.OBJ
THX im Voraus
-
Habt ihr eine Idee, wie ich das hinbekomme?
-
Ich habe das selbe Problem. Aber bei mir kommen solche Fehler bei'm EXE-Programm!
MFG Peter!