We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Decompile to C# in SB-Prime - Checkbox Console App
#1
The Chess Engine SB_Scout is a mixed application with a text window and a graphics window. (PDVF923.000)
As it is not a pure console application, I have disabled the checkbox "Export as Console App".
Is the following error related to this or is there another cause?


   
Reply
#2
Try exporting as a console app - this just means that it can use the TextWindow as a Console - it will also be able to use the GraphicsWindow.  I did test for the C# export with a simple TW and GW case using an extension before I posted on the other thread and my very simple case did work, something like:

Code:
TextWindow.WriteLine("Hello World")
LD3DView.AddView(GW.Width,GW.Height,"True")

The error message looked like it was getting null back from the TextWindow call when a key was pressed.  Not quite sure how your program works, but exported C# appears to work for me when exported as Console - if I remember there was some funny use of the console to commicate with chess engine or maybe that was something different.  If there are any actions I need to do with the program to make it fail, then please let me know.
[-] The following 1 user Likes litdev's post:
  • Scout
Reply
#3
Here are the results with single-line GW and TW programs:
An error occurs if the program contains a TextWindow command and the "Export as Console" checkbox is not set.
The program cannot provide a console for the text window.
"Export as Console" should therefore only be disabled if you are absolutely sure that the program does not contain a text window command.

If "Export as Console" is enabled, very little changes and could therefore always remain set.

In the project file .csproj, the output type changes from Winexe to Exe:
Code:
  <OutputType>Exe</OutputType>

The following 3 lines are inserted in the main() function:
Code:
//Initialise and hide TextWindow for Console App
TextWindow.Show();
TextWindow.Hide();
[-] The following 1 user Likes Scout's post:
  • litdev
Reply
#4
A Console app always creates a Console, that's why I added the 3 lines to create and hide a TextWindow, which derives from a Console.
The default option is to make a Console app, which for SB pretty much always makes sense.  Only if you were to extend the exported project under some circumstances not being a Console might be a better option.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)