[Gambas-user] Calling external function by pointer
Benoît Minisini
gambas at ...1...
Thu May 8 20:30:13 CEST 2014
Le 08/05/2014 19:38, Bruno Félix Rezende Ribeiro a écrit :
> Em Thu, 8 May 2014 18:41:13 +0200
> Tobias Boege <taboege at ...626...> escreveu:
>
>> I understand if you want to be able to do all the things in pure
>> Gambas but for that, new syntaxes must be created and I can't imagine
>> how those could fit into the existing Basic language elements...
>
> That's the whole point of this. I'm creating a component
> entirely written in Gambas which interfaces with a complex C library.
> This is a unique opportunity to discover weaknesses in Gambas language
> in this particular domain. Personally I'd like to make Gambas as
> simple and powerful as possible. I'd like to see Gambas as a standalone
> language in the sense that everything one could possibly want to
> implement with it could be done using only plain Gambas, at least in
> principle. I have to respectfully disagree with you, because I can
> clearly see how the improvements can nicely fit together within the
> Basic language. We are already plenty of facilities to interface with
> external C libraries, why not just add a few more to make Gambas
> components independent of the C language? If we had reasoned by the
> principle you just claimed, why on earth would Gambas support external
> function declarations, for example? Does that actually fit better
> within Basic than my, usually small, proposed improvements? What's the
> logic behind providing several and the main facilities to interface to
> external libraries and omitting a handful useful ones which would
> otherwise make the language functionally complete? In my view, while
> programming components, we should only resort to C(++) language for
> speed, not functionality.
If The Gambas GUI components were just direct calls to the GTK+ or Qt
API, how many Gambas programmers would have been able to write a GUI
program? Not a lot I guess.
Not that you are wrong in the sense that Gambas should be able to
directly call system shared libraries (those which are written in C.
Those written in C++ can't be reliably used).
But your goal of making a 1 to 1 interface to the XLib library is very
strange to me : nobody uses that library directly anymore, except those
who are forced to.
I will try my best to fit your needs, but I can't guarantee that, for
exemple, I will be able to find and implement a syntax to call any
function pointer knowing the function signature. It's a matter of libffi
possibilities, available time, and interpreter coherency!
Regards,
--
Benoît Minisini
More information about the User
mailing list