my solution is set up:
Solution
| --vbProject
| |-----References
| |-----cppProject
| |-----mscorlib
|--cppProject
| |-----References
| |-----vbProject
| |-----mscorlib
i've also been playing around, keeping it simple
right now i get complier" error C2065 'objVB' : undeclared identifer"
my code is like this:
-----------------------
int cppClass::go(){
objVB *test;
}
-------------------------
and if i hover the mouse over objVB it says "__gc class vbProject::objVB" in a popup bubble. now should i have some type of "using vbProject" im a little new at this cross compiling with vb and c++ in the same solution....
im thinking im missing some includes/using/somthing

2 projects same solution
DrunkenProgrammer
To understand the problem of circular reference better read this post as well:
http://forums.microsoft.com/msdn/ShowPost.aspx PostID=13348
Regards,
Vikram
44332211
could you clear that up a bit
Arun Manglick
unless there is a way to take a "complex" class that depends on other class' in it's own project (IE the VB class') and pass just 1 instance to C++ by Reff or by complete object.
because my problem is:
1) I cannot seperate the VB class i want to pass from the project into another project because of dependencys
2) IF I dont seperate them i get a circular refference problem.
That is why i came to the conclusion just add a refference to the C++ project in the VB project and use it's functions. without passing the VB class into the C++ class.
everything works fine until the C++ trys to make an object out of a class that is included from a unmanaged header file. ( might i add ) the .cpp/.h files compile in the same C++ project. just when im running the VB app it dies when it trys to create the object.
error: "An unhandled exception of type 'System.StackOverflowException' occurred in hadbxcl.dll"
dampbarn
There is one workaround to overcome the circular reference problem without changing anything. That is to actually not reference and instantiate classes at runtime dynamically.
You can go ahead and reference the VB dll from C++ but do not reference the C++ in VB.NET. Then use Type.GetTypeFromClsId to get the type of the C++ class if the C++ DLL is a COM DLL. And then pass the type as a parameter to Activator.CreateInstance and use the methods again using Reflection - this would have a performance overhead but it would work.
Regards,
Vikram
LanceDelano
You can remove this circular reference by creating a new project and extracting all classes you want to share across multiple projects in there:
|-- vbProjectShared
|-- cppProjectShared
|-- vbProject
| |-- vbProjectShared
| |-- cppProjectShared
|-- cppProject
|-- vbProjectShared
|-- cppProjectShared
FocusedWolf
So now im just using it 1 sided. ie creating a C++ object in VB and calling functions.
only 1 problem everything comiples but as soon as C++ code try's to make a new object out of a class that is not "managed code" it throws a stack overflow error. but if i take that part out and just have a simple class managed class.
ie
-----------------------------------------------
System::String *myFunction(System::String *parm1, System::String *parm2){
....
return str;
}
------------------------------------------------
it works. i can pass a string into my C++ function from VB and get it back on the return. then MsgBox it to screen.
but when i put in some includes and start to refference thing's outside my managed class
---------------------------------------------------------------
#include "unManaged.h"
System::String *myFunction(System::String *parm1, System::String *parm2){
unManaged *um = new unManaged(); // <------------------here
....
return str;
}
----------------------------------------------------------------
as i step through and debug the program it dies right there with stack overflow
funny though i had issues using CStirng as well. in my managed class.
Anyone have a clue how i can use my unManaged class it comiples just dies when the program is running
NewbeeVFP
As for Activator.CreateInstance that can be used to instantiate any dotnet type. And when u use Type.GetTypefromClsId, u can consume COM Objects as well with an automatic layer of COM Interop that .NET Provides.
Regards.
Vikram