aur1
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору #include <iostream> #include <windows.h> typedef double (*pfn_wspgCPIDT)(int,double); typedef double (*pfn_wspPST)(double); typedef double (*pfn_wspVPT)(double,double); //Здесь вопрос. Как записать typedef для фунции с несколькими возвращаемыми параметрами //p,t - входные параметры //все остальные выходные typedef double (__stdcall *pfn_wspVUSHCVWDERPTPT)(double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double * ); int main(int, const char**) { SetConsoleCP(1251); // установка кодовой страницы win-cp 1251 в поток ввода SetConsoleOutputCP(1251); // установка кодовой страницы win-cp 1251 в поток вывода std::cout << "Hello world! Привет! Привет! Привет! " << std::endl; pfn_wspPST wspPST; pfn_wspVPT wspVPT; pfn_wspgCPIDT wspgCPIDT; pfn_wspVUSHCVWDERPTPT wspVUSHCVWDERPTPT; HMODULE dll = LoadLibrary("okawsp6.dll") ; if ( !dll ) { std::cerr << "Can`t load library!" << std::endl; return 1; } wspgCPIDT = (pfn_wspgCPIDT)GetProcAddress(dll, "wspgCPIDT"); wspPST = (pfn_wspPST)GetProcAddress(dll, "wspPST"); wspVPT = (pfn_wspVPT)GetProcAddress(dll, "wspVPT"); wspVUSHCVWDERPTPT= (pfn_wspVUSHCVWDERPTPT)GetProcAddress(dll, "wspVUSHCVWDERPTPT"); if ( !wspPST ) { std::cerr << "Not wspPST in the library!" << std::endl; FreeLibrary(dll); return 1; } double Cpg=wspgCPIDT(6, 373.15); std::cout<<Cpg<<" wspgCPIDT \n"; double dP=wspPST(140+270); std::cout<<dP<<" Pa \n"; double VV=wspVPT(4000000.0,400.0); std::cout<<VV<<" m3/кг \n\n"; double p=36000000.0 ; double t=410.0 ; double v = 0, u = 0, s = 0, h = 0, Cv = 0, w = 0, DVDPt = 0, DUDPt = 0, DSDPt = 0, DHDPt = 0, DVDTp = 0,DUDPTp=0, DSDPTp = 0, DHDTp = 0; // wspVUSHCVWDERPTPT функция из okawsp6.dll wspVUSHCVWDERPTPT(p, t, &v, &u, &s, &h, &Cv, &w, &DVDPt, &DUDPt, &DSDPt,&DHDPt,&DVDTp,&DUDPTp,&DSDPTp,&DHDTp); std::cout<<v<< " v m3/кг \n"; std::cout<<u<< " u Дж/кг \n"; std::cout<<s<< " s Дж/(кг К) Всё работает\n"; std::cout<<h<< " = h \n"; FreeLibrary(dll); return 0; } | Всего записей: 56 | Зарегистр. 28-08-2007 | Отправлено: 14:48 19-04-2021 | Исправлено: aur1, 17:00 19-04-2021 |
|