Quote:Original post by Seroja
Why make it in VB:
1) Kind of a challenge for myself - to see if I can make it ALL by myself.
2) Have the whole program written in one language.
3) Have it in as global functions, and not as functions of a class.
4) Be able to change anything I want (though not really relevant as they make it work, but still makes me feel better, hate stuff I can't change crash).
That's your choice. It seems like a lot of work to get it up and running and fixing bugs to get it working reliably on all platforms when Tao's already doing the same thing, but hey...
Quote:
I need Marshal only for pointers. VB doesn't have them properly, so I use stuff like PtrToStringAnsi. I guess there could be a way around this by using dummy functions and ByRef, but Marshal works well until now.
Marshal doesn't work?!?! I use Marshal.Copy when loading textures and my program works fine on Linux! Maybe it's more recently added, but I know Marshal.Copy works on Mono 1.0.5.
You should only need pointers for interacting with the underlying API, but the wrapper exposing it as a .Net function should handle that. Even if you write your own wrapper, that should be the only place you need pointers. That's if you're writing your wrapper like Tao, which to your app treats them as .Net types (I.E. glGetString would return a System.String instead of a char[]). If you write your wrapper in that style, it will be easier to use as you only do the conversions in one place isntead of everywhere you use the function.
Quote:
About WinForms, any example on creating cross-platform forms in VB? The best I can do is open a form in C-style, through API calls. But that would still be a WinForm. Or are there APIs like CreateWindow on all platforms?
If you want to write cross-platform WinForms, you should write your code on Mono and only use things that work on Mono. That will be extremely limiting, though.
You could also use a cross-platform library like GTK#. I think that would need to be installed to run on Windows, though. With GTK# you can use the stand-alone program Glade to design your windows and load that file into your .Net app to create the window at runtime. I've messed around with it a bit in C# on Linux; it's not too complicated.
Quote:
And it *might* work on one compile, I think VB allows to declare functions that don't exist and doesn't throw an error as long as you don't try to use them.
As a side note, what is faster, Win32 API or .Net framework? I mean, there are many functions that are present in both, e.g. TicksCount. I know I should use .Net for cross-platformness, but won't that slow me down?
In general, good .Net code should get ~95% of the speed of good C++ code. I don't know how that changes with win32 and WinForms, but remember that on Longhorn win32 will be legacy code, even moreso than WinForms.
Alternatively, if you choose to use GTK#, they will probably eventually write a new version that runs directly on top of the Longhorn API.