473,385 Members | 1,409 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,385 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 1965
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.