Re: Shared library with resources which contain bitmaps on Linux -- second try
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';
> 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');
> IF FhMod <> 0 THEN begin
> FreeLibrary (FhMod);
> 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".
On Wed, June 25, 2008 13:07, Michael Van Canneyt wrote:
> On Tue, 24 Jun 2008, Tom Carly wrote:
>> > With version 2.3.1, you can try the new support for resources,
>> > and it should work "out of the box".
>> How can you obtain 2.3.1? I cannot find it in the repository...
> You can get 2.3.1 only from subversion.
... or you can get a binary snapshot from our FTP server
(ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/i386-linux/) if you
prefer that to compilation from sources. However, the snapshot is limited
to the .tar.gz version, no .rpm or .deb.