libQT4Pas - Why it is needed?

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

libQT4Pas - Why it is needed?

Krzysztof
Hi,

I am wondering. If I build application for linux using gtk2 widgetset
for GNOME (or XFCE etc.) and send this program to my friend, then he
can run it without any external librarys (of course if he have gnome
too), this same thing on windows. But why when I build application on
KDE interface I need some external libQT4Pas to run it and my friend
need it too (he have KDE so all QT librarys too)? There is no
libGTK4Pas so why exists layer libQT4Pas? What is difference between
GTK and QT librarys?

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

Re: libQT4Pas - Why it is needed?

Jonas Maebe-2

On 29 Jan 2012, at 15:29, Krzysztof wrote:

> But why when I build application on
> KDE interface I need some external libQT4Pas to run it and my friend
> need it too (he have KDE so all QT librarys too)? There is no
> libGTK4Pas so why exists layer libQT4Pas? What is difference between
> GTK and QT librarys?

GTK offers a plain C interface. QT only offers a C++ interface. FPC does not (fully) support directly calling external C++ libraries. LibQT4Pas offers a plain C interface to QT for use by FPC.


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

Re: libQT4Pas - Why it is needed?

Michael Van Canneyt
In reply to this post by Krzysztof


On Sun, 29 Jan 2012, Krzysztof wrote:

> Hi,
>
> I am wondering. If I build application for linux using gtk2 widgetset
> for GNOME (or XFCE etc.) and send this program to my friend, then he
> can run it without any external librarys (of course if he have gnome
> too), this same thing on windows. But why when I build application on
> KDE interface I need some external libQT4Pas to run it and my friend
> need it too (he have KDE so all QT librarys too)? There is no
> libGTK4Pas so why exists layer libQT4Pas? What is difference between
> GTK and QT librarys?

GTK has a procedural C interface, it is exposed in the GTK libraries.
The FPC compiler understands this interface.

Qt is written in C++, and exposes C++ classes in the Qt libraries.
The FPC compiler does not know how to handle C++ classes.
Therefor, a 'procedural' interface to the C++ needs to be made, and
this is libQT4Pas. It is generated by a GCC.

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

Re: libQT4Pas - Why it is needed?

Krzysztof
Just as I thought - it is object class thing. So if "FPC does not
(fully) support directly calling external C++ libraries" there are
plans to support it? This will be great

2012/1/29 Michael Van Canneyt <[hidden email]>:

>
>
> On Sun, 29 Jan 2012, Krzysztof wrote:
>
>> Hi,
>>
>> I am wondering. If I build application for linux using gtk2 widgetset
>> for GNOME (or XFCE etc.) and send this program to my friend, then he
>> can run it without any external librarys (of course if he have gnome
>> too), this same thing on windows. But why when I build application on
>> KDE interface I need some external libQT4Pas to run it and my friend
>> need it too (he have KDE so all QT librarys too)? There is no
>> libGTK4Pas so why exists layer libQT4Pas? What is difference between
>> GTK and QT librarys?
>
>
> GTK has a procedural C interface, it is exposed in the GTK libraries. The
> FPC compiler understands this interface.
>
> Qt is written in C++, and exposes C++ classes in the Qt libraries. The FPC
> compiler does not know how to handle C++ classes.
> Therefor, a 'procedural' interface to the C++ needs to be made, and this is
> libQT4Pas. It is generated by a GCC.
>
> Michael.
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: libQT4Pas - Why it is needed?

noreply
Do other languages like python use the plain c interface, or C++?

how about something like ruby, lua, objective C, php ..



Krzysztof wrote:

> Just as I thought - it is object class thing. So if "FPC does not
> (fully) support directly calling external C++ libraries" there are
> plans to support it? This will be great
>
> 2012/1/29 Michael Van Canneyt <[hidden email]>:
>>
>>
>> On Sun, 29 Jan 2012, Krzysztof wrote:
>>
>>> Hi,
>>>
>>> I am wondering. If I build application for linux using gtk2 widgetset
>>> for GNOME (or XFCE etc.) and send this program to my friend, then he
>>> can run it without any external librarys (of course if he have gnome
>>> too), this same thing on windows. But why when I build application on
>>> KDE interface I need some external libQT4Pas to run it and my friend
>>> need it too (he have KDE so all QT librarys too)? There is no
>>> libGTK4Pas so why exists layer libQT4Pas? What is difference between
>>> GTK and QT librarys?
>>
>>
>> GTK has a procedural C interface, it is exposed in the GTK libraries.
>> The
>> FPC compiler understands this interface.
>>
>> Qt is written in C++, and exposes C++ classes in the Qt libraries. The
>> FPC
>> compiler does not know how to handle C++ classes.
>> Therefor, a 'procedural' interface to the C++ needs to be made, and this
>> is
>> libQT4Pas. It is generated by a GCC.
>>
>> Michael.
>>
>> _______________________________________________
>> fpc-pascal maillist  -  [hidden email]
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>

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

Re: libQT4Pas - Why it is needed?

wkitty42
On 1/29/2012 17:38, Lars wrote:
> Do other languages like python use the plain c interface, or C++?
>
> how about something like ruby, lua, objective C, php ..


:( i don't nderstand why one would want to apply interpreted script languages,
al la BASIC, to today's tasks... sure, these are neat and "more modern" but they
are still interpreted scripting languages :(

> Krzysztof wrote:
>> Just as I thought - it is object class thing. So if "FPC does not
>> (fully) support directly calling external C++ libraries" there are
>> plans to support it? This will be great
>>
>> 2012/1/29 Michael Van Canneyt<[hidden email]>:
>>>
>>>
>>> On Sun, 29 Jan 2012, Krzysztof wrote:
>>>
>>>> Hi,
>>>>
>>>> I am wondering. If I build application for linux using gtk2 widgetset
>>>> for GNOME (or XFCE etc.) and send this program to my friend, then he
>>>> can run it without any external librarys (of course if he have gnome
>>>> too), this same thing on windows. But why when I build application on
>>>> KDE interface I need some external libQT4Pas to run it and my friend
>>>> need it too (he have KDE so all QT librarys too)? There is no
>>>> libGTK4Pas so why exists layer libQT4Pas? What is difference between
>>>> GTK and QT librarys?
>>>
>>>
>>> GTK has a procedural C interface, it is exposed in the GTK libraries.
>>> The
>>> FPC compiler understands this interface.
>>>
>>> Qt is written in C++, and exposes C++ classes in the Qt libraries. The
>>> FPC
>>> compiler does not know how to handle C++ classes.
>>> Therefor, a 'procedural' interface to the C++ needs to be made, and this
>>> is
>>> libQT4Pas. It is generated by a GCC.
>>>
>>> Michael.
>>>
>>> _______________________________________________
>>> fpc-pascal maillist  -  [hidden email]
>>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>>
>> _______________________________________________
>> fpc-pascal maillist  -  [hidden email]
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>

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

Re: libQT4Pas - Why it is needed?

zeljko
In reply to this post by Krzysztof

On Sunday 29 of January 2012 22:16:45 Krzysztof wrote:

> Just as I thought - it is object class thing. So if "FPC does not

> (fully) support directly calling external C++ libraries" there are

> plans to support it? This will be great


Maybe it is possible (or will be possible) to use C++ class, but I don't see light at the end of tunnel for eg override virtual routine from such C++ class which is possible by C interface or howto attach callback (event) from pascal to C++. So if it isn't possible then what's the point with C++ support ?


zeljko


>

> 2012/1/29 Michael Van Canneyt <[hidden email]>:

> > On Sun, 29 Jan 2012, Krzysztof wrote:

> >> Hi,

> >>

> >> I am wondering. If I build application for linux using gtk2 widgetset

> >> for GNOME (or XFCE etc.) and send this program to my friend, then he

> >> can run it without any external librarys (of course if he have gnome

> >> too), this same thing on windows. But why when I build application on

> >> KDE interface I need some external libQT4Pas to run it and my friend

> >> need it too (he have KDE so all QT librarys too)? There is no

> >> libGTK4Pas so why exists layer libQT4Pas? What is difference between

> >> GTK and QT librarys?

> >

> > GTK has a procedural C interface, it is exposed in the GTK libraries. The

> > FPC compiler understands this interface.

> >

> > Qt is written in C++, and exposes C++ classes in the Qt libraries. The

> > FPC compiler does not know how to handle C++ classes.

> > Therefor, a 'procedural' interface to the C++ needs to be made, and this

> > is libQT4Pas. It is generated by a GCC.

> >

> > Michael.

> >

> > _______________________________________________

> > fpc-pascal maillist  -  [hidden email]

> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal

>

> _______________________________________________

> fpc-pascal maillist - [hidden email]

> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



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

Re: libQT4Pas - Why it is needed?

zeljko
In reply to this post by wkitty42

On Monday 30 of January 2012 03:28:45 waldo kitty wrote:

> On 1/29/2012 17:38, Lars wrote:

> > Do other languages like python use the plain c interface, or C++?

> >

> > how about something like ruby, lua, objective C, php ..

> :

> :( i don't nderstand why one would want to apply interpreted script

> :languages,


I've understand that he asks how python bindings works then ? Probably same way as our libQt4Pas. You cannot use Qt python without python bindings for qt - so no direct C++ usage.


zeljko


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

Re: libQT4Pas - Why it is needed?

Felipe Monteiro de Carvalho
In reply to this post by noreply
On Sun, Jan 29, 2012 at 11:38 PM, Lars <[hidden email]> wrote:
> Do other languages like python use the plain c interface, or C++?
>
> how about something like ruby, lua, objective C, php ..

No idea, but Python, ruby, lua and php do not generate real programs
but instead are just scripts which run in a interpreter, which is
immensely different from a real program.

A more close comparison to Pascal might be asking what Fortran, Cobol,
Ada or other similar compiled languages do, and I think that all of
those would need a C interface.

I know very well Java due to Android work, which cannot bind to
anything directly. It requires a special format using plain procedures
in a special way, so it is like a C interface, or a plan Pascal
procedural interface. It is called JNI and it will never accept C++

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

Re: libQT4Pas - Why it is needed?

Graeme Geldenhuys-2
In reply to this post by Jonas Maebe-2
On 29 January 2012 16:31, Jonas Maebe  wrote:
>
> GTK offers a plain C interface. QT only offers a C++ interface. FPC does not (fully) support directly calling external C++ libraries. LibQT4Pas offers a plain C interface to QT for use by FPC.
>

Can one statically bind the LibQt4Pas into a FPC program, thus not
require to ship an external libqt4pas DLL/SO? If possible, that might
solve the original posters problem.




--
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: libQT4Pas - Why it is needed?

wkitty42
In reply to this post by zeljko
On 1/30/2012 01:55, zeljko wrote:

> On Monday 30 of January 2012 03:28:45 waldo kitty wrote:
>
>  > On 1/29/2012 17:38, Lars wrote:
>
>  > > Do other languages like python use the plain c interface, or C++?
>
>  > >
>
>  > > how about something like ruby, lua, objective C, php ..
>
>  > :
>
>  > :( i don't nderstand why one would want to apply interpreted script
>
>  > :languages,
>
>
> I've understand that he asks how python bindings works then ?

i may have easily misunderstood the OP's post... i tend to read in literan
english format... ie: if you say eggs are round, that is where i base my
response unless it is very obvious that there is something else to consider
which i point out ;

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

Re: libQT4Pas - Why it is needed?

michael.vancanneyt
In reply to this post by Krzysztof


On Sun, 29 Jan 2012, Krzysztof wrote:

> Just as I thought - it is object class thing. So if "FPC does not
> (fully) support directly calling external C++ libraries" there are
> plans to support it? This will be great

There are no plans to support it, since every C++ compiler uses it's own
(incompatible) format, and G++ changes it format regularly, so I was
given to understand.

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

Re: libQT4Pas - Why it is needed?

zeljko
In reply to this post by wkitty42

On Monday 30 of January 2012 08:35:23 waldo kitty wrote:

> i may have easily misunderstood the OP's post... i tend to read in literan

> english format... ie: if you say eggs are round, that is where i base my

> response unless it is very obvious that there is something else to consider

> which i point out ;


I think that this question was pretty clear:


"Do other languages like python use the plain c interface, or C++?"


zeljko



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

Re: libQT4Pas - Why it is needed?

noreply
In reply to this post by wkitty42
waldo kitty wrote:

> On 1/29/2012 17:38, Lars wrote:
>> Do other languages like python use the plain c interface, or C++?
>>
>> how about something like ruby, lua, objective C, php ..
>
>
> :( i don't nderstand why one would want to apply interpreted script
> languages,
> al la BASIC, to today's tasks... sure, these are neat and "more modern"
> but they
> are still interpreted scripting languages :(
>

Eh, I meant how does ruby, lua, objective c, and similar tools bind the
C++ api. Do they use an automatic tool that converts QT C++ objects to
procedural? or by hand, someone converts the objects to procedures and
structs? Or do they use the c++ objects directly to python objects..


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

Re: libQT4Pas - Why it is needed?

noreply
In reply to this post by Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote:
> On Sun, Jan 29, 2012 at 11:38 PM, Lars <[hidden email]> wrote:
>> Do other languages like python use the plain c interface, or C++?
>>
>> how about something like ruby, lua, objective C, php ..
>
> No idea, but Python, ruby, lua and php do not generate real programs
> but instead are just scripts which run in a interpreter, which is
> immensely different from a real program.

"Real Programmers"...

When you use pascal to build web programs you use templates, right.. so
you are interpreting templates. When you read an INI file you are
interpreting the INI file. Some pascals, safe ones, are interpreted. Like
Oberon, or  UCSD Pascal. When you parse an Edit.Text and check it to make
sure there is not some user error on input, you are interpreting things.
Compiled programs are not fully compiled, they always contain some run
time interpretation.  When you use regexes they are interpreted. When you
use wildcards in search boxes they are interpreted.  From my testing, CGI
programs that are compiled binaries, are actually SlowER than PHP
programs. I am no fan of PHP , but it is pretty fast.


>
> A more close comparison to Pascal might be asking what Fortran, Cobol,
> Ada or other similar compiled languages do, and I think that all of
> those would need a C interface.
>

True, but still interesting to know if Python objects are somehow
compatible with C++ objects, as a kind of academic exersise.. how do they
do it? Possibly they just bind to procedural API, but it would be cool if
they somehow did it more effectively.  I also mentioned Objective C in my
request but I have no idea if objective c even has a QT binding..

> I know very well Java due to Android work, which cannot bind to
> anything directly. It requires a special format using plain procedures
> in a special way, so it is like a C interface, or a plan Pascal
> procedural interface. It is called JNI and it will never accept C++
>

That's good information and adds to the knowledge.. of how they do it. Cool.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: libQT4Pas - Why it is needed?

Den Jean
In reply to this post by michael.vancanneyt

On Monday 30 January 2012 09:28:00 [hidden email] wrote:

> There are no plans to support it, since every C++ compiler uses it's own

> (incompatible) format, and G++ changes it format regularly, so I was 

> given to understand.

even with support for calling c++ methods,

the many inlined functions are still an issue


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

Re: libQT4Pas - Why it is needed?

Sven Barth-2
In reply to this post by zeljko

Am 30.01.2012 07:53 schrieb "zeljko" <[hidden email]>:
>
> On Sunday 29 of January 2012 22:16:45 Krzysztof wrote:
>
> > Just as I thought - it is object class thing. So if "FPC does not
>
> > (fully) support directly calling external C++ libraries" there are
>
> > plans to support it? This will be great
>
>
> Maybe it is possible (or will be possible) to use C++ class, but I don't see light at the end of tunnel for eg override virtual routine from such C++ class which is possible by C interface or howto attach callback (event) from pascal to C++. So if it isn't possible then what's the point with C++ support ?

The C++ support in the compiler isn't advanced enough to even remotely think about that yet.

Regards,
Sven


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

Re: libQT4Pas - Why it is needed?

zeljko
In reply to this post by Den Jean

On Monday 30 of January 2012 11:51:10 Den Jean wrote:

> On Monday 30 January 2012 09:28:00 [hidden email] wrote:

> > There are no plans to support it, since every C++ compiler uses it's own

> > (incompatible) format, and G++ changes it format regularly, so I was

> > given to understand.

>

> even with support for calling c++ methods,

> the many inlined functions are still an issue


Yes, there's only one thing which can put some light over it, and that is if qt nokia decides to create pure C bindings as separate packages (dlls) for qt libs .. but it won't happen .... so long live libQt4Pas


zeljko


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

Re: libQT4Pas - Why it is needed?

Sven Barth-2
In reply to this post by michael.vancanneyt

Am 30.01.2012 09:22 schrieb <[hidden email]>:
>
>
>
> On Sun, 29 Jan 2012, Krzysztof wrote:
>
>> Just as I thought - it is object class thing. So if "FPC does not
>> (fully) support directly calling external C++ libraries" there are
>> plans to support it? This will be great
>
>
> There are no plans to support it, since every C++ compiler uses it's own
> (incompatible) format, and G++ changes it format regularly, so I was given to understand.

I wouldn't say that there is no plan for C++ support as some code for this already exists in the compiler.
While it's true that different C++ compilers are incompatible to each other and that also G++ likes to change its formats now and then, the basic memory layout in G++ is rather stable. The biggest problems is getting this supported at all, interfacing with the C++ Std library and things like virtual methods, etc.

Regards,
Sven


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

RE : [fpc-pascal] libQT4Pas - Why it is needed?

Ludo Brands
In reply to this post by noreply
> Eh, I meant how does ruby, lua, objective c, and similar
> tools bind the
> C++ api. Do they use an automatic tool that converts QT C++ objects to
> procedural? or by hand, someone converts the objects to
> procedures and structs? Or do they use the c++ objects
> directly to python objects..
>

The smoke wrapper http://techbase.kde.org/Development/Languages/Smoke is
used by a lot of these languages. See also
http://lists.trolltech.com/qt-interest/2006-08/thread00721-0.html.

Smoke is actually a tool that generates runtime wrappers for c++ libraries.
It supports virtual methods, multiple inheritance etc.

Ludo

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