Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi every body
i wanna run or compire c++ or python code in mine vb.net project
can i do this??
any source code ??
any idea??any component???
any Trick??
Posted
Comments
Sergey Alexandrovich Kryukov 25-Aug-12 1:32am    
This is a pretty big question; a lot of things is involved. But not to hard to implement; it just needs some time. So, first, would you explain the goal of it? Do you want to create something like a small Visual Studio? Or something else? What?
--SA

First of all, you can execute any external application using one of System.Diagnostics.Process.Start methods:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^].

Pay attention that you can redirect output of your external process (a compiler, C++ or Python code, compiled application, etc.) to some stream and use it in your parent process. To do so, you will need to redirect StandardOutput and StandardError. Please see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx[^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standarderror.aspx[^].

Both MSDN help article referenced above contain some redirection code samples.

If you really mean not C++, but C++/CLI, you can dynamically compile and load the .NET assembly in your host application. This is a pretty complex problem if you need to make such code reloadable, because there is no way to unload an assembly, you you would need to create and unload separate Application Domains and worth through the Application Domain boundary with IPC. You can find further detail in my past answers:
Create WPF Application that uses Reloadable Plugins...[^],
AppDomain refuses to load an assembly[^],
code generating using CodeDom[^],
Create WPF Application that uses Reloadable Plugins...[^],
Dynamically Load User Controls[^],
C# Reflection InvokeMember on existing instance[^].

As to the Python, you also can think about using Python for .NET. Such thing does exist, called IronPython:
http://en.wikipedia.org/wiki/IronPython[^],
http://ironpython.net/[^].

All the options I mentioned may or may not be applicable. I don't know you goals, that's why. Next time, please start asking your question with explanation of your ultimate goals.

—SA
 
Share this answer
 
Comments
rpm3d 25-Aug-12 1:58am    
hi Sergey ...how are you??first i tried send comment on your website but i couldn't maybe have problem...LOL
and about it not exactly small Visual Studio...but i think about it and this is my future project.....
so now
i am working on a project in this i need to some script of python and some source code of c++...and i should to use of them mean when is run i copmile them and run...so
what is your idea....or others idea..??
Sergey Alexandrovich Kryukov 25-Aug-12 2:12am    
Many people addressed to me via my "Contact me" page on the Web site without problems...
Why other idea? What I've written in my answer is applicable.
--SA
Espen Harlinn 25-Aug-12 8:14am    
Nice reply :-D
Wendelius 25-Aug-12 10:29am    
Good answer :)
Sergey Alexandrovich Kryukov 5-Sep-12 3:30am    
Thank you, Mika.
--SA
hi Sergey ...how are you??first i tried send comment on your website but i couldn't maybe have problem...LOL
and about it not exactly small Visual Studio...but i think about it and this is my future project.....
so now
i am working on a project in this i need to some script of python and some source code of c++...and i should to use of them mean when is run i copmile them and run...so
what is your idea....or others idea..??
:)
 
Share this answer
 
v2
Have a look at SharpDevelop[^] - it even includes a c# to vb converter.

SharpDevelop also supports IronPython - so there you have all you're asking for :-D

Best regards
Espen Harlinn
 
Share this answer
 
Comments
rpm3d 25-Aug-12 8:21am    
damn it thank you...very nice
Wendelius 25-Aug-12 10:30am    
That's a good link!
Espen Harlinn 25-Aug-12 16:52pm    
Thank you, Mika :-D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900