473,320 Members | 1,838 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,320 software developers and data experts.

REALLY mixed source files

It occured to me that C++, C# and VB (ok, and J#, are you happy now? : ) are
becoming so close that it makes sense to have a 'langauge' that allows
mixing these in the same source!

That is, if the source file is ".cpp" it compiles as a C++ source, ".cs" a
C# source file, and ".vb" for visual basic source. As long as they are
isolated in this way, the calling convention could make it possible to not
have to choose amongst VB, C++, C# (and, OK, J#) as an 'environment', but
just have VS.NET (in contrast to VS C++.NET vs. VS VB.NET). By calling
convention I mean that, in most cases, methods in any language can be called
from, and classes constructed in another language can be refered to, by
using a slightly different syntax (e.g., C# uses '.' for scoping while C++
uses '::").

I'm guessing this isn't possible right now, but it seems like a natural
extension ot the trend towards unification going on with the languages of
VS.NET. Ultimately, it might even be posible to have 'blocks' of code in one
source file that are really another language. For example, in a ".cpp" have
something like a '#start_block visual basic' with a '#finish_block' ender.
In other words, a sort of extension to the way in-line coding mixes assembly
with high-level languages...

[==P==]
Dec 8 '05 #1
9 1163
"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:u5**************@TK2MSFTNGP10.phx.gbl...
That is, if the source file is ".cpp" it compiles as a C++ source, ".cs" a
C# source file, and ".vb" for visual basic source. As long as they are
isolated in this way, the calling convention could make it possible to not
have to choose amongst VB, C++, C# (and, OK, J#) as an 'environment', but
just have VS.NET (in contrast to VS C++.NET vs. VS VB.NET). By calling
convention I mean that, in most cases, methods in any language can be
called ...
I'm guessing this isn't possible right now, but it seems like a natural
extension ot the trend towards unification going on with the languages of
VS.NET.


What is sad to this old dinosaur is that what you describe was possible on
the VAX over twenty years ago.

In truth there were issues - the initialization of the runtimes, necessity
to mark some parameters as "by ref" or "by val" depending on the language -
but it was eminently possible to write an application in C and do numerical
stuff in Fortran.

Just by the way, you can't do what you describe within a single project, but
you can partition an application into assemblies, each of which is written
in the desired language. In fact, it is this ability of .Net that allows for
applications written in J#, say, to use the base class library which was
written in C# and C++.

Regards,
Will
Dec 8 '05 #2
"William DePalo [MVP VC++ ]" <wi***********@mvps.org> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl...
Just by the way, you can't do what you describe within a single project,
but you can partition an application into assemblies, each of which is
written in the desired language.


See
http://groups.google.com/group/micro...88ecba0f64b348

for a discussion of how you can mix and match languages within a single
..exe. It works great!

-- David
http://www.dcsoft.com

Dec 9 '05 #3
"David Ching" <dc@remove-this.dcsoft.com> wrote in message
news:ha*******************@newssvr21.news.prodigy. com...
"William DePalo [MVP VC++ ]" <wi***********@mvps.org> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl...
Just by the way, you can't do what you describe within a single project,
but you can partition an application into assemblies, each of which is
written in the desired language.


So you are translating between source languages?

If so, and you need to make a change, do you make a change to the original
or the translated source file.

Regards,
Will
Dec 9 '05 #4
William DePalo [MVP VC++ ] wrote:
"David Ching" <dc@remove-this.dcsoft.com> wrote in message
news:ha*******************@newssvr21.news.prodigy. com...
"William DePalo [MVP VC++ ]" <wi***********@mvps.org> wrote in
message news:OI**************@TK2MSFTNGP10.phx.gbl...
Just by the way, you can't do what you describe within a single
project, but you can partition an application into assemblies, each
of which is written in the desired language.


So you are translating between source languages?


I guess you didn't read the link. Basically, you can get something out of
C# or VB.NET that the VC++ linker can accept as input (a 'netmodule'), so
you can build a single DLL or EXE that contains code from several languages.

-cd
Dec 9 '05 #5
"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message
I guess you didn't read the link.
I just scanned it. I thought someone was peddling a tool.
Basically, you can get something out of C# or VB.NET that the VC++ linker
can accept as input (a 'netmodule'), so you can build a single DLL or EXE
that contains code from several languages.


I'm probably being thick (again <g>) but I thought that netmodules were DLLs
that are a kind of sub-assembly to be linked into a a "final" assembly. Good
as far as it goes, but there is still the intervening link step.

Regards,
Will
Dec 9 '05 #6
William DePalo [MVP VC++ ] wrote:
"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message
I guess you didn't read the link.

I just scanned it. I thought someone was peddling a tool.

Basically, you can get something out of C# or VB.NET that the VC++ linker
can accept as input (a 'netmodule'), so you can build a single DLL or EXE
that contains code from several languages.

I'm probably being thick (again <g>) but I thought that netmodules were DLLs
that are a kind of sub-assembly to be linked into a a "final" assembly. Good
as far as it goes, but there is still the intervening link step.

Regards,
Will

You end up with a single file assembly that is basically
indistinguishable from builing it all together in the first place. Not
sure that matches your understanding or not.

Note that this is a new 2005 feature. In 2002 and 2003 .netmodules could
not be used to build a single file assenmbly. They could only be used as
parts of a multi-module assembly as you describe.

Ronald Laeremans
Visual C++ team
Dec 9 '05 #7
"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:u0*************@TK2MSFTNGP12.phx.gbl...
You end up with a single file assembly that is basically indistinguishable
from builing it all together in the first place. Not sure that matches
your understanding or not.

Note that this is a new 2005 feature. In 2002 and 2003 .netmodules could
not be used to build a single file assenmbly. They could only be used as
parts of a multi-module assembly as you describe.


That's cool.

I didn't realize that building an assembly from netmodules w/2003 didn't
yield a single file assembly.

And in the give-'em-an-inch-and-they'll-take-a-mile-department ...

.... wouldn't it be cool if you could just add, say, C# and C++/CLI source
files to the same project and be done with it. ;-)

Regards,
Will
Dec 9 '05 #8
William DePalo [MVP VC++ ] wrote:
"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:u0*************@TK2MSFTNGP12.phx.gbl...
You end up with a single file assembly that is basically indistinguishable
from builing it all together in the first place. Not sure that matches
your understanding or not.

Note that this is a new 2005 feature. In 2002 and 2003 .netmodules could
not be used to build a single file assenmbly. They could only be used as
parts of a multi-module assembly as you describe.

That's cool.

I didn't realize that building an assembly from netmodules w/2003 didn't
yield a single file assembly.

And in the give-'em-an-inch-and-they'll-take-a-mile-department ...

.... wouldn't it be cool if you could just add, say, C# and C++/CLI source
files to the same project and be done with it. ;-)

Regards,
Will

Seeing that the build model is completely different (C# is
build-everything-at-once, C++ is per file compilation) that would be
extremely hard and probably have surpriszing semantics if we were to try.

Ronald
Dec 12 '05 #9
"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Seeing that the build model is completely different (C# is
build-everything-at-once, C++ is per file compilation) that would be
extremely hard and probably have surpriszing semantics if we were to try.


It's just another case of things appearing easy to those who aren't tasked
with the job. :-)

Regards,
Will
Dec 15 '05 #10

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

Similar topics

16
by: Franz Steinhaeusler | last post by:
Hi, I looked at tabnanny to check a python source file. But I didn't find anything, tabnanny is able to find, what couldn't be found by compile command. Or have I missed something? best...
6
by: Gert Mellak | last post by:
Hi! I'm writing an online-shop that receives data-updates about the company's products as xml-files. I'm not sure about the Group-Tags - is this really xml-standard?? They should represent the...
4
by: Vu Pham | last post by:
I have a project that has at least one c++ file and some other c files. Could you please advice which one is better ( in performance ) ? 1. Convert all c files to c++ file by renaming the...
8
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
7
by: Staale L. Hansen | last post by:
We have an application which uses some mixed-mode code to expose a .NET 1.1 managed API. Only the necessary files are compiled with /clr. We want to be able to load the application without .NET...
5
by: DFB | last post by:
I am the author of the ZLibNetWrapper project on SourceForge (located at zlibnetwrapper.sf.net). This project is a simple mixed-mode .NET wrapper around the ZLib compression library. The ZLib...
3
by: dfranzen | last post by:
Hi *, I'm in the process of porting an ANSI C++ project from a UNIX platform to .NET. After "getting rid of" some platform-specific stuff I managed to compile the first two libraries into mixed...
7
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I'm new to working with mixed assemblies. All of my previous experience has been with VC++/MFC in native, unmanaged applications. When I create a mixed assembly in which one or more of the files...
8
by: Bern McCarty | last post by:
We have a large mixed dll that I can never seem to get to link incrementally. Below is the console output. For simplicity I've eliminated some stuff that we normally do when we really link this...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.