[fpc-pascal]How to use Linux libraries?
rainer at hantsch.co.at
Sat Jul 26 09:06:06 CEST 2003
Hi, Micha, and thanks for your detailled answer.
In fact, you are right. I do not force JPEG. Though, it is one of the most
common file formats.
I also thought about using an external program to convert any type of image
into one easy to read format and then reading this one in. This 'quick and
dirty method' may be ok as a workaround, but is not very optimal for permanent
usage, because I have to load&execute i.e. Imagemagick's 'convert' for every
particular picture. This is slow and causing a relatively high activity on the
harddisk, therefore I discontinued this thought very soon.
The better solution will definitely be to convert data inside my application,
because it loads once and then can convert continuously picture by picture (I
plan to use a WEB-CAM for something like a simple motion detection, i.e., so I
will have to convert permanently, not only once at program start).
What I am not understanding is:
Most programs I can see in SuSE Linux use shared object libraries. These
libraries are ready to use modules, can be used within multiple programs, and
save me from re-inventing all this basic stuff again and again. There already
was somebody who wrote these libraries and solved all problems with time, so
why should I decide to do the same bloody way? (I also use the MySQL library
without starting to analyze and re-code the whole communication protocol!)
What (in addition) is making me think is:
I have a friend who writes (with FPC) his own graphical applications for
Windoze - with complete GUI support. He wrote once a library to simplify the
API of Windoze, and now he can use Windoze in a procedural way. Looks
relatively easy. He simply uses existing Windoze *.dll files to do all this
basic stuff and also does not have to worry about how to read in a JPG in
detail. The *.dll's do this job, and he simply has to call them the right way.
I may be totally wrong, but as far as I understand, Linux' *.so files are the
same as Windoze' *.dll files in their meaning. So shouldn't it be possible to
use them in the same manner, by loading them and talking to them?
| Oh, one more thing - Pasjpeg unit uses TStream classes and you said you
| dont like Classes. But, really, they are so simple - I guarantee that
| you will be glad when you learn how to use them and when you see what
| TStream and it's descendants can do for you.
Classes are possibly fine, otherwise they would not be such common. But as far
as I understand, you cannot mix Class Style programming and OOP programming
in one program (would also make life not easier, even when this would work).
This means that I would have to re-write a lot of code only to be able to use
it longer. --> Makes no real sense to me.
Ing. Rainer Hantsch
More information about the fpc-pascal