Mensaje    Asunto: Error en este código (sobre DLL's) Responder citando

Hola, tengo este código:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
typedef int(__stdcall *PFUNC)(char *, unsigned short);
HINSTANCE hinstDLL = LoadLibrary("midll.dll");
PFUNC getInfo;
bool bRet;
int iValor;

if ( hinstDLL) {
getInfo = reinterpret_cast<PFUNC> (GetProcAddress(hinstDLL,"getInfo"));
if(getInfo)
iValor = getInfo(IP,puerto);
FreeLibrary(hinstDLL);
}
}

Parece bastante sencillo no? Pero esta parte parece que la hace bien pero a la hora de salir/cerrar el formulario me da un error de Access Violation.
¿Alguien sabe pq?

Merci