PDA

View Full Version : About C, Dll/so, headers and life



{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 :)

Clootie
30-01-2005, 10:15 AM
Are you talking about IDL? :D :D :D

PS. The .NET is solution here - then programmiong in .NET languages you don't need headers at all! :)

{MSX}
30-01-2005, 11:57 AM
Are you talking about IDL? :D :D :D

Well possibly something like that. I don't know that very well.
But can that be used in the way i said ?



PS. The .NET is solution here - then programmiong in .NET languages you don't need headers at all! :)

I hate .NET.
I could shot myself instead of programming in .NET :D

Clootie
30-01-2005, 01:34 PM
Are you talking about IDL? :D :D :D

Well possibly something like that. I don't know that very well.
But can that be used in the way i said ?
IDL is a standart to expose headers. IIRC CORBA using it as a standart. Delphi, C++ have IDL import, generating proprietary language headers from IDL file.




PS. The .NET is solution here - then programmiong in .NET languages you don't need headers at all! :)

I hate .NET.
I could shot myself instead of programming in .NET :D
Well then in Windows world you will not have a future after about 5 years :)

{MSX}
30-01-2005, 01:50 PM
IDL is a standart to expose headers. IIRC CORBA using it as a standart. Delphi, C++ have IDL import, generating proprietary language headers from IDL file.


So why aren't we using this to produce headers ?





I hate .NET.
I could shot myself instead of programming in .NET :D
Well then in Windows world you will not have a future after about 5 years :)

Eheh i don't have a future in windows right now :P Already using it 99% of the time (except at work.. :( )

Clootie
30-01-2005, 02:05 PM
IDL is a standart to expose headers. IIRC CORBA using it as a standart. Delphi, C++ have IDL import, generating proprietary language headers from IDL file.


So why aren't we using this to produce headers ?
Because C++ developers don't care?