{MSX}
29-01-2005, 10:52 PM
(wx.net is a C level wrapper dll around the C++ wxWindows, meant for easier importing in .NET, but that goes for FPC too. wx.net itself is not .NET)
This made me think about a thing..
All libraries and dll that are written with whatever language need headers to be used in other languages.. actually, they need headers also for the language they are written (so for example you have sdl.h, gtk.h etc, etc).
This lead to a great amount of work to be done for every language that uses the library. They often have a big number of API and types (thousands) so that translating a header is usually very hard.
I was thinking: is all this work really necessary? Couldn't it be done automatically?
The answare is that it could all be avoided, imho.
For example, the dll/so could include procedures, parameters and data types.. They could be designed in a language independent way (for example giving basic information about it: "signed 8 bit, unsigned 32 bit, float IEEE 32 bit, etc", this could include also records (let's avoid classes..). For procedure , the specification could indicate calling convention and parameter passing mode).
In this way, each language could have set of translation rules from which to derive automatically language-dependet types and calls. At this point one could autogenerate header files (or also avoid using them at all).
The specification could be included in the DLL or shipped with a companion file.
The implementation of this system would not be hard since the compiler of the dll/so already have all the information it need.. it should only write them down.
Obviously all this apply only where languages have compatible features, that is practically all except classes.
I hope i was clear :mrgreen:
What do you think about this ? Is it a flow of non-sense ? :P
I'll sleep over it :)
This made me think about a thing..
All libraries and dll that are written with whatever language need headers to be used in other languages.. actually, they need headers also for the language they are written (so for example you have sdl.h, gtk.h etc, etc).
This lead to a great amount of work to be done for every language that uses the library. They often have a big number of API and types (thousands) so that translating a header is usually very hard.
I was thinking: is all this work really necessary? Couldn't it be done automatically?
The answare is that it could all be avoided, imho.
For example, the dll/so could include procedures, parameters and data types.. They could be designed in a language independent way (for example giving basic information about it: "signed 8 bit, unsigned 32 bit, float IEEE 32 bit, etc", this could include also records (let's avoid classes..). For procedure , the specification could indicate calling convention and parameter passing mode).
In this way, each language could have set of translation rules from which to derive automatically language-dependet types and calls. At this point one could autogenerate header files (or also avoid using them at all).
The specification could be included in the DLL or shipped with a companion file.
The implementation of this system would not be hard since the compiler of the dll/so already have all the information it need.. it should only write them down.
Obviously all this apply only where languages have compatible features, that is practically all except classes.
I hope i was clear :mrgreen:
What do you think about this ? Is it a flow of non-sense ? :P
I'll sleep over it :)