Proper documentation how to compile a project

Nov 20, 2015 at 4:04 AM
Edited Nov 20, 2015 at 4:22 AM
In the start page, it refer to Babylon3D documentation about instruction how to compile the project.

However, it's not clear enough for the beginner (like me) to getting started and it's little bit weird to put / refer the instruction on another project.

It will be good idea to put (clearer) instruction under this project documentation
Also, will project that uses System.Drawing work?
Coordinator
Nov 20, 2015 at 12:57 PM
Thx for your question.

1) Ideally All documentation is written on "Home page". What you need to do is to convert each DLL/EXE into C file and then compile. So for more complex compile example you can have a look into the file package_05112015.7z and learn *.bat files how to compile LINQ example.

2) I have created project for OpenGL because converting C# into C not converting all Win32 API stack into C thus the parts of code which need access to System DLLs will not work but you can provide your calls to well-known DLLs (for example opengl API) and bypass this issue. Returning back to System.Drawing will not work as is you need to amend it a bit

and finally I wish to have more time to write proper documentation with videos but I don't have it so ...

Regards
Alex
Coordinator
Nov 20, 2015 at 2:45 PM
Edited Nov 20, 2015 at 2:46 PM
Let's have a look at System.Drawing call
// System.Drawing.SafeNativeMethods.Gdip
[DllImport("gdiplus.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static extern int GdipDrawBezier(HandleRef graphics, HandleRef pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
IL2C will generate call to it but will not provide body for it, so when you compile C file to generate exe or lib it will show an error: missing link so you can add your C file which will provide body to a function for example
Int32 Int32_System_Drawing_GdipDrawBezierF......N(System_HandleRef* graphics, System_HandleRef* pen, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3, Single x4, Single y4)
{
    return 0;
}
And so on.
Nov 28, 2015 at 9:24 AM
Edited Nov 28, 2015 at 11:02 AM
Thanks for the reply!
It's sounds almost impossible to use System.Drawing without messing C File.
I'm creating game based on OpenTK and this library reference System.Drawing.dll

Is it possible to keep referencing OpenTK while my main program is converted to C (my program doesn't reference System.Drawing.DLL)?
Nov 28, 2015 at 5:38 PM
Also, I tried to build the sample (build_test_with_mscorlib.bat) and try to run the compiled .exe
After the exe is generated, its execute, but show this error messagebox: "The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library linq.exe"
Coordinator
Nov 29, 2015 at 1:49 PM
CXO2 wrote:
"The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library linq.exe"
You need to use g++ compiler (MinGW32)

as I remember linq example is broken in the current build. I will update files soon.
Coordinator
Nov 29, 2015 at 1:50 PM
CXO2 wrote:
Is it possible to keep referencing OpenTK while my main program is converted to C (my program doesn't reference System.Drawing.DLL)?
No, it is not possible
Nov 29, 2015 at 2:19 PM
Edited Nov 29, 2015 at 2:21 PM
AlexDev wrote:
You need to use g++ compiler (MinGW32)

as I remember linq example is broken in the current build. I will update files soon.
Yes, I installed MinGW and execute the example bat that included in the package.
And that errors is happen when I launched the produced exe

When I download the MinGW, the filename is i686-4.8.2-release-posix-dwarf-rt_v3-rev4.7z
is this compatible?

AlexDev wrote:
No, it is not possible
Will future CSNative support System.Drawing.DLL? I'm sure it's gonna be useful in most cases (I know it might need a lot of works, especially to make it platform independent), if you gonna support this, you might want to remove the functions that heavily depend on Win32 API so it make less work for you and stay compilable across many platforms.

My game nor OpenTK actually doesn't depend on complicated functions inside System.Drawing.DLL, it only use: Rectangle and Size (RectangleF and SizeF too), Icon, Color, Images and Bitmap.

I believe those (and maybe there are more) classes doesn't require Win32 API and can be re-created under C.
I, myself got no experience on C language, so I can only suggest and I have not digging into deep the internal codes of .NET

btw keep up nice work! I hope this library continue grown and better!
Dec 5, 2015 at 9:33 PM
Hello, sorry for asking again
But How do I convert EXE/DLL into C?

in the Homepage, the instructions only show how to convert C# Source Code (CS File) to C..
Coordinator
Dec 6, 2015 at 6:13 PM
Edited Dec 6, 2015 at 7:25 PM
Il2c.exe <your file>.dll
if file is using extra references, copy all dlls into the folder where you run the app il2c.exe

Sometimes it is important to provide the core library
Dec 7, 2015 at 3:32 AM
Thanks for your reply!
However I got an error..

Please see this issue:
https://csnative.codeplex.com/workitem/6
Coordinator
Dec 7, 2015 at 8:00 AM
I have seen it, I will have a look