Hello all,

How can I generate dynamically loaded resource file *.so on linux to
be able to load it?

When I link my *.lrs file into executable then I can read it fine, but
I tried to make *.so file which contains resources, then it is not
able to read it from and it results an error "Resource "pict" not
found".

My code for dynamic resource library:

library libmyres;

{$mode objfpc}{$H+}

uses LResources;

initialization
  {$I libmyres.lrs}
end.


What did I wrong?


My test code for resource file is the following:

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 sucessfully loaded');
    
    Image1.Picture.Bitmap.LoadFromResourceName (FhMod, 'pict');
  end;

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

procedure TForm1.Button2Click(Sender: TObject);
begin
  Image1.Picture.Bitmap.LoadFromLazarusResource('pict');
end;

initialization
  {$I main.lrs}
  {$I libmyres.lrs}

end.


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

_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to