[fpc-pascal] Shared library with resources which contain bitmaps on Linux -- second try
Michael Van Canneyt
michael at freepascal.org
Tue Jun 24 14:33:03 CEST 2008
On Tue, 24 Jun 2008, Roland Turcan wrote:
> 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".
With FPC 2.2.2, the answer is simple: you cannot.
With version 2.3.1, you can try the new support for resources,
and it should work "out of the box".
Michael.
More information about the fpc-pascal
mailing list