Page 1 of 1
How works the Compiler
Posted: Tue Oct 10, 2017 8:46 am
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
How works the Compiler
Posted: Tue Oct 10, 2017 9:39 am
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
How works the Compiler
Posted: Tue Oct 10, 2017 12:45 pm
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
How works the Compiler
Posted: Tue Oct 10, 2017 1:00 pm
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
How works the Compiler
Posted: Tue Oct 10, 2017 2:14 pm
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