On Delphi 2009, on a new VCL project:
procedure TForm1.FormCreate(Sender: TObject); var Handle: THandle; begin Handle := loadlibrary('oci.dll'); if Handle <> 0 then begin try ShowMessage('Success'); finally FreeLibrary(Handle); end; end else ShowMessage('Fail'); end;
If i run the Exe from the IDE, it fails, if i run the EXE from the directory, just on double clicking on it it’s a success !!??
Please tell me what I’m missing.
Thanks, Fred
EDIT: Launching the EXE via the IDE works with Delphi 7 !! WTf is the problem with D2009 ??
The usual problem with LoadLibrary failing is that the required DLL is not in the DLL search path. It’s possible that D2009 is not searching the same folders for some reason.
To make sure, you should get more details of the error, using something like…
Try (even temporarily) placing ‘oci.dll’ in the same directory as you project’s .EXE, and try again.
Here are some things to check: