fbpx

How works the Compiler

More
1 year 3 months ago #1 by Horst Korak
How works the Compiler was created by Horst Korak
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

Please Log in or Create an account to join the conversation.

More
1 year 3 months ago #2 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic How works the Compiler
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

Please Log in or Create an account to join the conversation.

More
1 year 3 months ago #3 by Robert van der Hulst
Replied by Robert van der Hulst on topic How works the Compiler
Horst,

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

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
1 year 3 months ago #4 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic How works the Compiler
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

Please Log in or Create an account to join the conversation.

More
1 year 3 months ago #5 by Horst Korak
Replied by Horst Korak on topic How works the Compiler
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

Please Log in or Create an account to join the conversation.