General Question, Compiler Intelligence

JaedenRuiner

Well-known member
Joined
Aug 13, 2007
Messages
340
Programming Experience
10+
Given the nature of Assemblies versus "units" or "include files" I am wondering about the intelligence, or better yet the design of the VB.Net compiler.

Given the situation of Pascal or C++, for instance, I can have a repository
C:\Source\Include
which contains all my .h/.cpp or .pas files whatever the language. Then in any given program I can Include (uses in pascal) the file, and the include search path automatically scans that directory for the file I'm requesting.

Now, for .Net such repositories are done through Assemblies, which compile into DLLs and are thus included with the final compiled exe but as a separate file, which may or may not be appropriate given a specific application design.

However, sometimes instead of including the Assembly Library as an dependent project, it can be just a simple to add the specific .vb file to the current application project, and I get all the functionality of the specific "repository" without having to include the entire library dll with the final application.

My question revolves around doing this specifically, due to the nature of assembly compilation, say a module I wish to include has some extensions for varying types and some other multipurpose functions, lets say around 50 of them.

Now the nature of the Delphi and C++ compiler is a multi-pass compilation that investigates each included file for the final EXE linkage, which if in a given application I am only using 4 functions out of the 50 in an included source file, only compiles those 4 functions into the resulting object for linking, instead of the entire 50 function file.
Does the VB.net Compiler do the same? If a file I've added to the project contains 50 functions, but I only use 4, does it still compile all 50 into the resulting EXE assembly, or due to the final assembly being an executable does it eliminate the superfluous functions in deference to space.

Thanks
 
Why not compile it, open it in Reflector, and have a look ?
You could also compile it, reference it from another project, then discover it's types/members.
 
Well,

okay, yea, i guess i could investigate that way. I'm just more or less looking at the prospect of trying to create a repository of source code that once written may be accessed by multiple projects without having to include an Assembly DLL with it.

I'm guessing that C# still allows that kind of behavior from it's parent C++, but then again maybe not. *shrug*
 
Back
Top