Solar wrote:
Be aware that the parameters of main() are part of the standard. You can, of course, add something like the WinAppMain() wrapper to your runtime environment...
You can overload main, and create a crt0 stub that tries the C++ my-type main first, then the C++ default main and only after that the C main.
Unfortunately, the rest of your post refers mainly to the user-space part of your design. (Which I won't comment on; as a long-time C++ coder I have some gripes with it but that ain't the topic here.)
But I still don't get where exactly you have to pass a type as string, and why you can't get around it in "cleaner" style. Do I understand correctly that you want to pass the type names to a kernel syscall? (Why? Wouldn't a user-space stream server be better?)
Even if you do so as a user-level object, it's a /template/. They are COMPILED IN and can thus never be changed again. There is no practical way to replace them with later-developed stuff.
However.
By using a way to bypass the templates-are-compiled-in doctrine, you can use later-compiled templates as if they were compiled in. This is the exact way to do it, you cannot use templates and you still need to know what the type of the template is, so you explicitly request that as a string. You CAN NOT do that without the typeid or by using inheritance or anything. The storing, loading etc. is a breeze then.
I think the part you're missing is the time part. In normal compilation templates work nicely because everything is present and can be linked in without a problem. However, this is the situation:
Developer one develops a program with any type of audio file. He cannot link against your to-be developed FLAC library since you haven't already developed it and he obviously doesn't have it. He thus links against a blank type of audio filter without knowing what's behind it.
He codes an Ogg Vorbis decoder module, that needs to store what it does in a form that's not compile-time, as in, plain text. The type this would declare is probably (in GCC 3.3.4 syntax with typeid) PN3aos4file5audioE:ogg to N3aos6streamE: . This is equivalent in normal syntax with filter<aos::file::audio *, aos::stream>("ogg", ""). By storing this the module loader can compare the request (for this module) with the actual module at runtime, instead of at compile time. The external links are only created at loading the module, which means that even while your mp3 player runs you can add Ogg support to it. It can (if programmed properly) detect this automatically and allow you to instantly add Ogg files.
You develop, at the same time but on the other side of the world, an AAC module. It conforms to the default format, so it converts from PN3aos4file5audioE:aac to N3aos6streamE:.
The music player program writer was smart and asked the module system for all inputs with a module path to N3aos6streamE: (with audio qualifier, but I don't know how to mangle that in yet). This delivers, after installing just your OS-level AAC plugin, the capability for the music player to load aac files, and it thus asks the system for all filetypes it can play using those modules.
In other words, the most used programs at this time will be freshman programs in a few years, and a full computer game engine should take about a day, given the modules you need (that includes rendering etc.). Also, you develop a separate interface, modules and system modules, which is something I've been aiming for quite a while. One does the interface design and basic code behind it (if necessary with a little help from a programmer), any number create the required modules without strict linking to the other, everybody has a clear interface and you can use all prior art without a hitch. It also eases creating addons to games, new interfaces for music players etc. so these categories finally get free play between media players in terms of the user interface alone, not linked with the formats. It could all be tested with previous formats with less features.
The reason for this export is that I have to be able to store and load the description of the module in template form. I must therefore know what the template is in written form in the source.