// указатель на функцию, которая принимает параметр char* и возвращает int
typedef int (__cdecl *_your_function)(char *auth_st);
_your_function YourFunction;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HINSTANCE hLib = LoadLibrary("Path_to_DLL");
YourFunction = (_your_function)GetProcAddress((HMODULE)hLib, "Your_Function_name");
if(YourFunction == NULL) {
//something wrong
}
int res = YourFunction ("some string");
}
objdump -d a.exe
00401600 <__Z4fooBv>:
call 402890 <__ZN1A3fooEv>
0040161c <__Z4fooAv>:
call 402890 <__ZN1A3fooEv>
00401638 <_main>:
401643: e8 d4 ff ff ff call 40161c <__Z4fooAv>
401648: e8 b3 ff ff ff call 401600 <__Z4fooBv>
objdump -t b.o
b.o: file format pe-i386
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 b.cpp
File
[ 2](sec 5)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text$_ZN1A3fooEv
AUX scnlen 0x17 nreloc 2 nlnno 0 checksum 0x0 assoc 0 comdat 2
[ 4](sec 5)(fl 0x00)(ty 20)(scl 2) (nx 1) 0x00000000 __ZN1A3fooEv
AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0
[ 6](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __Z4fooBv
objdump -t a.o
a.o: file format pe-i386
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 a.cpp
File
[ 2](sec 5)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text$_ZN1A3fooEv
AUX scnlen 0x17 nreloc 2 nlnno 0 checksum 0x0 assoc 0 comdat 2
[ 4](sec 5)(fl 0x00)(ty 20)(scl 2) (nx 1) 0x00000000 __ZN1A3fooEv
AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0
[ 6](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __Z4fooAv
OnInitDialog()
{
CDialog::OnInitDialog();
HBITMAP hBitMap = (HBITMAP)::LoadImage(0, FileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
CStatic* m_picture = (CStatic *)GetDlgItem(IDC_QRIMAGE);
m_picture->ModifyStyle(0xF, SS_BITMAP, SWP_NOSIZE);
m_picture->SetBitmap(hBitMap);
}
void array(double *arr, int size) {
int i;
double sum = 0, product = 1;
for (i = 0; i < size; i++) {
sum = sum + arr[i];
product = product * arr[i];
}
printf("%f", sum);
printf("%f", product);
}
int main() {
double arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
array(arr, sizeof(arr)/sizeof(arr[0]));
return 0;
}