U++ framework
Do not panic. Ask here before giving up.

Home » Community » Coffee corner » Load dll with U++
Re: Load dll with U++ [message #56704 is a reply to message #56703] Sun, 04 April 2021 06:20 Go to previous messageGo to previous message
BetoValle is currently offline  BetoValle
Messages: 206
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member
Hi Novo, Thanks

In example below with traditional way also works but ... why application freeze when set FreeLibrary ?

this will not cause a problem or in the end does the code generated in U ++ free from memory?


...
typedef void (*importFunction)(int, int, int, int, char *); 
...
void AA::clickDll2(){
	importFunction fscreen;

	HINSTANCE hinstLib = LoadLibrary(AppendFileName("C:\\Temp\\outU++\\NOVOXXX\\CLANGx64.Debug.Debug_Full.Gui", "CaptureScreenDll.dll"));
 	if (hinstLib == NULL) {
 		PromptOK("ERRO: não foi possível carregar a DLL\n");
 		return;
 	}	
 	fscreen = (importFunction)GetProcAddress(hinstLib, "capture_screen");
 	if (fscreen == NULL) {
 		PromptOK("ERRO: não foi possível achar a função na DLL\n");
                //FreeLibrary(hinstLib);  uncommenting will abort here
 		return;
 	} 	

 	char* f="teste2.png";
    fscreen(0,0,500,600,f);
    
    //FreeLibrary(hinstLib); uncommenting will abort here
	
}


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Hello Upp World
Next Topic: Compiler Options Hardening Guide for C and C++
Goto Forum:
  


Current Time: Sun May 10 23:05:42 GMT+2 2026

Total time taken to generate the page: 0.00574 seconds