[2005] Interact with C++ Project
Hey,
I was wondering how do you interact with a C++ project in VB that are both in the same solution. I tried to Add Reference - Projects but I got an error message.
Actually the file in the C++ project is actually a C file so I don't know if that complicates things anymore. In the Debug folder I see the project is outputted as a .obj file if that helps.
Re: [2005] Interact with C++ Project
There are really only three ways that a .NET app can interact with external libraries. If the library is a .NET assembly then it can be referenced directly. if the library isa COM component then it can be referenced indirectly via COM interop. Otherwise the library would have to export functions which can then be declared as external functions using either the 'Declare' statement or the 'DllImport' attribute. If your C++ project is not managed then the first option is not open to you. If you have not compiled the C++ project as a COM component then the second option is not open to you either. If you're using C code files then the third option is likely to be the only one available to you.
Re: [2005] Interact with C++ Project
Hmm, looks like I have another problem that may not be fixable. Right now the C++ Project outputs values to the console using printf().
Is there a way to call the main executable and then store whatever values are outputting into a string using C#? This is pretty far fetched and I wouldn't be surprised if this isn't possible...
Re: [2005] Interact with C++ Project
Quote:
Originally Posted by r_barlow
Hmm, looks like I have another problem that may not be fixable. Right now the C++ Project outputs values to the console using printf().
Is there a way to call the main executable and then store whatever values are outputting into a string using C#? This is pretty far fetched and I wouldn't be surprised if this isn't possible...
Checkout the CodeBanks... Gigemboy has an example on how to redirect command window's output into your app.
http://www.vbforums.com/showthread.p...utput+redirect