grijjy / GrijjyFoundation

Foundation classes used by other Grijjy repositories
Other
247 stars 88 forks source link

Update function GetProc in unit Grijjy.OpenSSL.API to include the full name of the DLL when an exception is raised #12

Open jpluimers opened 5 years ago

jpluimers commented 5 years ago

Current code in Grijjy.OpenSSL.API does not include the name of the DLL:

function GetProc(AModule: HMODULE; const AProcName: String): Pointer;
begin
  Result := GetProcAddress(AModule, PChar(AProcName));
  if (Result = nil) then
    raise Exception.CreateFmt('%s is not found', [AProcName]);
end;

Even the short name of the DLL will make it hard to find why it fails: only the full name will give enough context on why it does not load.

(I will make a pull request for this later)

allendrennan commented 5 years ago

It wasn't clear if you just wanted the name of the library included or the path to the library with the name? On other platforms, the library is statically linked and GetProcAddress() is not used. Also the new version of this will be entirely dynamically linked and not use GetProcAddress() at all. We could include a library name though.