[fpc-pascal] Shared library with resources which contain bitmaps on Linux

Roland Turcan konf at rotursoft.sk
Mon Jun 23 10:25:21 CEST 2008


Hello FPC-Pascal users discussions!

How can I build a shared library which contains many bitmaps loaded
dynamically from the code using by:

procedure TForm1.Button1Click(Sender: TObject);
CONST MYRES_DLL    ='./libmyres.so';
begin
  FhMod := LoadLibrary (PCHAR (MYRES_DLL));

  IF FhMod = 0 THEN begin
    ShowMessage ('Failed to load library ' + MYRES_DLL + '.');
  end else begin
    ShowMessage ('Library ' + MYRES_DLL + ' is successfully loaded');
    
    Image1.Picture.Bitmap.LoadFromResourceName (FhMod, 'pict');
  end;

  IF FhMod <> 0 THEN begin
    FreeLibrary (FhMod);
  end;
end;


I have tried to do it in all ways I know, but loading the shared
library was OK, but the LoadFromResourceName raises an exception
"Resource XY not found".

Thanks in advance.

-- 
Best regards, TRoland
http://www.rotursoft.sk
http://exekutor.rotursoft.sk




More information about the fpc-pascal mailing list