Shared library with resources which contain bitmaps on Linux -- second try

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Shared library with resources which contain bitmaps on Linux -- second try

Roland Turcan - RoTurSoft
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Shared library with resources which contain bitmaps on Linux -- second try

Michael Van Canneyt


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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Shared library with resources which contain bitmaps on Linux -- second try

Tom Carly
> 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...

BR

Tom

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Shared library with resources which contain bitmaps on Linux -- second try

Michael Van Canneyt


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.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Shared library with resources which contain bitmaps on Linux -- second try

Tom Carly
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.

I don't see it in the repository, the last release that is in there is 2_2_2.

Tom



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Shared library with resources which contain bitmaps on Linux -- second try

Jonas Maebe-2

On 25 Jun 2008, at 13:40, Tom Carly wrote:

>> You can get 2.3.1 only from subversion.
>
> I don't see it in the repository, the last release that is in there  
> is 2_2_2.

2.3.1 is not a release, it's the version number of the current main  
development version. So you have to check out trunk to obtain it.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Shared library with resources which contain bitmaps on Linux -- second try

Tomas Hajny
In reply to this post by Michael Van Canneyt
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.

Tomas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal