How works the Compiler

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

How works the Compiler

Post by Horst »

Hi

I have a little question.
I have a project and this project needs function.prg with 100 functions inside. But my project needs only one of this 100 function. What is the compiler doing ? He put all into the EXE or only the one ? What's about classes and methods ?

Horst
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

How works the Compiler

Post by wriedmann »

Hi Horst,

AFAIK in .NET all code is linked in. And the .NET runtime does not knows functions anymore, they are translated to static methods of a static class.
Of course, you can call all methods using Reflection at runtime, and the compiler cannot know that.

In VO, all classes and methods were linked in, and only the required functions from libraries were linked in. Therefore you needed the "request" statemtent or a dummy call when you had a dynamic call of a otherwise not referenced function.

In VO, all libraries are built into the exe, only DLLs remain outside, but are loaded at startup time.

In .NET there is no library as in VO, but only DLLs, and the .NET runtime loads them only when required the first time.

In VO, IMHO the best option was to build monolithic exe files, whereas in .NET you have better an EXE and DLLs to minimize build time (since there is no incremental compiler and linker anymore).

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

How works the Compiler

Post by robert »

Horst,

What Wolfgang says.
If you want to see what the compiler generates, then I suggest you download a product called ILSpy (https://sourceforge.net/projects/ilspyportable/) It allows you to look in / disassemble .Net assemblies.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

How works the Compiler

Post by wriedmann »

Hi Horst,

ILSpy as suggested by Robert (I'm using a similar commercial product .NET Reflector) is a tool that no .NET programmer should miss: with it you can look into most .NET assemblies if you need to understand how code is working. There are some 3rd party libs that are badly documented or not documented at all, and such a tool will permit you to look at the code.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

How works the Compiler

Post by Horst »

Hi

I did not found a working .Net ISAPI Extension example, thats why i am building CGI EXE's and this shoud be as small as possible.

So i will add only prg's i need in my project.

Horst
Post Reply