.


:




:

































 

 

 

 





. DLL ( .lib , ).

, . DLL :

extern "C" void __export Message(char *s) { Application->MessageBox(s,"From DLL",IDOK); }

C , DLL.

( OnClick) :(Unit11.cpp)

//---------------------------------------------------------------------------#include #pragma hdrstop#include "Unit11.h"#include //---------------------------------------------------------------------------#pragma package(smart_init)#pragma resource "*.dfm"TForm1 *Form1;//---------------------------------------------------------------------------__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner) { }//--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { void (__stdcall *Message)(char *s); HINSTANCE dllp = LoadLibrary("p.dll"); if (dllp) { Message= (void(__stdcall *) (char*)) GetProcAddress(dllp, "_Message"); if (Message) Message("Hi From Dinamic DLL"); } FreeLibrary(dllp); }//---------------------------------------------------------------------------

, . , .

  • void (__stdcall *Message)(char *s); - .
  • HINSTANCE dllp = LoadLibrary("p.dll"); - .
  • Message= (void(__stdcall *) (char*)) GetProcAddress(dllp, "_Message"); DLL.
  • Message("Hi From Dinamic DLL"); ( ).
  • FreeLibrary(dllp); - .

, ( ).

 





:


: 2015-10-01; !; : 431 |


:

:

. .
==> ...

1476 - | 1435 -


© 2015-2024 lektsii.org - -

: 0.008 .