Building .NET DLLS Using Basic4ppc Generated C# code?

Louis

Active Member
Licensed User
Longtime User
Hi. Lots of people have asked for certain algorithms or some examples I have programmed. However, they don't necessarily use Basic4ppc, but either C# or Visual Basic.net. I may experiment with quite the idea. I know Basic4ppc generates C# code so I am wondering is it possible to build a module, let Basic4ppc do the translating, then open a new Visual Studio or Sharp Develop project, ad all required C# files, remove functions like __main_globals and rename it to something more sensible, and compile a DLL? You could simply delee the Sub App_Start and possibly get a DLL directly from Basic4ppc. What do you guys think, feasible or just a waste of time? This would be cool because we could code in quite an easy language but share our code with others who choose the harder paths.
 
Last edited:

Louis

Active Member
Licensed User
Longtime User
Hi. Understandable about the Source Code issues. If I do figure it out, can I post the steps I took and will it be OK to distribute DLLS using this generated code for other programmers to benefit from, excluding the C# source? Thanks.
 

Cableguy

Expert
Licensed User
Longtime User
Hi. Understandable about the Source Code issues. If I do figure it out, can I post the steps I took and will it be OK to distribute DLLS using this generated code for other programmers to benefit from, excluding the C# source? Thanks.

Dlls Source code are not exclusive to the "Oficial" B4Ppc libraries, but also the user's developed dlls, in wich case their knowleage and permission should be prompted.
 

eww245

Member
Licensed User
Interesting idea, I assume it will work.
As said the b4p variables like __main and all the standard DBasic code would need to be removed.
I'd like to see how this experiment turns out.
 

agraham

Expert
Licensed User
Longtime User
Interesting idea, I assume it will work.
By now I know a lot about the C# emitted by Basic4ppc and it is certainly feasible but I doubt if it is sensible. I think that by the time you have learnt enough to turn the emitted code, which isn't very pretty as it doesn't need and isn't intended to be read by a human, into a valid C# dll that would compile and be usable by others you might as well just write it directly in C# or VB.NET. They are not actually very difficult nor very different to Basic4ppc if you just want to do the same in C# or VB.NET as in Basic4ppc.

As is often the case it is not really the language syntax that is the problem but learning the infrastructure and processes needed to make working code with your chosen tools. You need to learn to use the tools anyway to make a dll or exe and will need to know some of the language to make valid classes with public constructors, methods and properties that are accessible to programs copiled against them, so its better and probably simpler to just take that extra step and write the code as well.
 
Top