473,395 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to have multiple language sources in one project?

Hello
Every where in .NET books is mentioned that VS.NET is a seamless cross
platform environment. We have two groups of programmers that some are VB
programmer but others prefer to use C#. Is it possible to have a project
that accepts both kind of sources? I mean for example one class is in VB.NET
and the other in C#. Then one can trace or debug a mixed code that switches
between several languages code. In general when I want to create a project,
I should define the programming language and then I can't add a source of a
different language to it.

Thanks in advance

Hamed
Jul 21 '05 #1
3 1967
Cor
Hi Hamed,

You can use two projects with different languages in one project.
You cannot mix up source classes from one language into the other,

I hope this helps,

Cor
Jul 21 '05 #2
Hi Hamed,

VS.NET does not support it.
However, nothing prevents you to compile it from command line.
There is an example that comes with .NET SDK, you can find it at
{Program Files}\Microsoft Visual Studio .NET
2003\SDK\v1.1\Samples\Technologies\CrossDevLanguag e

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Hamed" <ha***@esol-co.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello
Every where in .NET books is mentioned that VS.NET is a seamless cross
platform environment. We have two groups of programmers that some are VB
programmer but others prefer to use C#. Is it possible to have a project
that accepts both kind of sources? I mean for example one class is in VB.NET and the other in C#. Then one can trace or debug a mixed code that switches between several languages code. In general when I want to create a project, I should define the programming language and then I can't add a source of a different language to it.

Thanks in advance

Hamed

Jul 21 '05 #3
Hamed wrote:
Hello
Every where in .NET books is mentioned that VS.NET is a seamless cross
platform environment. We have two groups of programmers that some are
VB programmer but others prefer to use C#. Is it possible to have a
project that accepts both kind of sources? I mean for example one
class is in VB.NET and the other in C#. Then one can trace or debug a
mixed code that switches between several languages code. In general
when I want to create a project, I should define the programming
language and then I can't add a source of a different language to it.


A single compiler will only compile code in a single language (the exception
is C++ *if* you consider C, C++ and managed C++ as different languages).
VS.NET projects are inherently single compiler - a project uses a single
compiler for all source files - thus projects can only be used to compile
source files of one language.

However, .NET IL is not language specific (I hate the term common language
runtime, because the runtime only JIT compiles and runs one language -
*Intermediate Language*). The problem is getting IL from different high
level languages into the same assembly. .NET has a solution in modules, but
VS.NET does not support this (well, for C# and VB.NET) because it does not
give you access to the appropriate command line switches. This means that
you have to use a makefile, and perhaps the VC++.NET makefile project is
your best approach here. The basic steps are:

1) create a module (use /t:module for both C# and VB.NET) for the source
files of each of the languages you use (ie one module for C#, one for
VB.NET)
2) create the assembly from the modules
a) for a 'VB.NET' assembly compile all .vb source files with vbc and add
the C# module with /addmodule, this gives you two files the assembly
manifest file (exe or dll) and the .netmodule, or
b) for a 'C#' assembly compile all .cs source files with csc and add the
VB.NET module with /addmodule, this gives you two files the assembly
manifest file (exe or dll) and the .netmodule, or
c) you can link the VB.NET and C# module with al.exe, , this gives you
three files the assembly manifest file (exe or dll) the C# and the VB.NET
..netmodules
3) Deploy all the modules in the assembly as one unit (even though
physically you may have more than one file in the assembly).

Note that 'public' and 'private' accessibility of a type does not apply
*within* the assembly, so one module can access the private (internal) types
in another module in the *same* assembly. However, the assembly exports
*all* of the public types exported from all of the modules.

A multimodule assembly does have memory advantages: if you put rarely-used
types in one module, that module will only be loaded when one of its types
is referenced, when the type is first used. If the rarely-used types are
never used in an execution of the assembly, the module is not loaded. When
you create a module and add it to an assembly, the compiler adds a hash of
the module to the assembly manifest file (assuming the assembly has a strong
name). When the module is load the runtime hashes the module and checks this
with the hash in the assembly manifest file. This ensures that the module
has not been tampered.

Of course, if you look at the framework you'll see that none of the
Microsoft assemblies are multimodule. I guess the reason is that under
Windows files are loaded into memory in chunks of page size (4096 bytes), a
multimodule assembly is likely to take up more memory than a single module
assembly, and the more modules you have , the more memory that will be
wasted. In general terms a process that is optimized for size will run
faster (due to less page swaps) than a process optimized for speed.

Richard
--
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
sign up for my free .NET newsletter at http://www.wd-mag.com/newsletters/
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Daniel Pryde | last post by:
Hi there. I'm currently trying to learn Python, my aim being to create my final year project at university using only Python instead of Java. I've run into a problem though while trying to make...
1
by: Dinesh | last post by:
Hi, my existing web application(vb,asp) takes data from diff sources and populates a sql server which is in turn used as the data source for the application. this population of data happens by...
0
by: Shailesh Ratadia | last post by:
The answer to this will largely depend on your source(s). Are these all databases? One approach would be to build a webservice layer which has specific methods to get data from each source and...
3
by: Newbee Adam | last post by:
anyone have any secrets or pearls about vb.net you want to share I was asked by my company to begin teach an introductory VB.Net course 2 day seminar. I had been teaching an sql server 2000...
5
by: farmer | last post by:
I need "include" multiple classes from multiple files such as: <%@ Page Language="C#" Debug="true" ValidateRequest="false" Src="~/Auth/Pub/Auth.cs"%> <%@ Page Language="C#" Debug="true"...
3
by: Hamed | last post by:
Hello Every where in .NET books is mentioned that VS.NET is a seamless cross platform environment. We have two groups of programmers that some are VB programmer but others prefer to use C#. Is it...
0
by: GS | last post by:
Documentation states that there supposed to be a "Data Sources" windows in VS 2005. See below. I can not find Data menu in VS 2005 anywhere. Anybody sees that menu? Opening the Data Sources Window...
19
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
0
by: BillE | last post by:
I am using Visual Studio 2005 to create a web site which includes reports. The web site has several sub-folders. When working with reports I can't get the website data sources (classes and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.