|
Hi!
I'm making a GUI for an engine I'm working on. The engine is separated into two win32 dll's and the GUI is supposed to be written in C#. I've decided to make the interface between C# and the engine using C++/CLI since that seems like the cleanest and best solution. So what I have is the following:
EngineA.dll - the two engine dll's in win32 code
EngineB.dll - *
SVCore.dll - The C++/CLI interface class. Exposes functionality from the engines
SceneViewer.exe - The gui
Now the problem arises when I'm trying to include a reference to SVCore into the SceneViewer project (etiher a reference to the project or to the target dll). The class compiles and I get the following warning:
"Warning 8 Could not load file or assembly 'SVCore, Version=1.0.2057.40039, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
The other problem is when I try to use a canvas control that's using SVCore. I get a similar error message saying that it failed to create the component because it failed to load SVCore or one of its dependencies.
Now I've found out that this is because the designer doesn't seem to find the engine dll's. I just find that strange since I've tried to place them everywhere within the project folders. Everything seems to work fine though when I put the dll's in the system32 directory - but this is NOT an option at all (editing the path is not an option either). So does anybody have any solutions as to how I should set up my projects for this to work? Or any other way to fix the problem?
Thank you in advance!
|
|
|
|
|
Hi _eulogy_,
I ran across your post over on the Microsoft Technical Forums. Pretty interesting stuff,...that left me thoroughly mystified.
Does your SceneViewer code derive from the IDesignerHost interface?
Given the sophistication of your project, I can't imagine that Visual Studio can't find your DLLs (this is TOO simple an error, and you obviously know your way around the compiler).
I've noticed that sometimes (and this happens to me all the time), if you create multiple intersecting errors that don't conform to the compiler's internal diagnotic logic, it will issue an error message, but that message will be misleading.
|
|
|
|
|
Thank you for the interest
No, I'm not inheriting from IDesignerHost and I'm still puzzled by this problem. I've found that doing the following things work:
1: Put the engine dll's in windows\system32
2: Put the location of the engine dll's in the path
3: Put the engine dll's in the same folder as devenv.exe
Point number three made me a bit more certain about a suspicion I had. It seems as though the ide loads up the managed dll's as normal from their right directories, because thir whereabouts are stored in the project. The unmanaged engine dll's on the other hand are only referenced by one of the managed dll's and in an "unmanaged way". The problem might be that the ide thinks that the current search directory is the same as the running exe resides in (which happens to be devenv.exe) and not the directory that the managed dll resides in or the directory pointed to by the project.
This is only a hypothesis though (hope my ramblings made sense :P).
|
|
|
|
|
Hmmm... seems like I was suddenly logged out.
|
|
|
|
|
I read what the responses were over at MS Technical Forums. I was on the wrong track with my last question.
In Visual C++ .NET you reference another .NET assembly by inserting the #using directive in your source code. You also, as you now know, must set the LIBPATH variable that the compiler uses to search for your associated .NET assemblies. This can be done very simply by opening the Property pages for your Project (from the Solution Explorer). The following MSDN information will explain this:
The Using Directive[^]
And, you might want to read this, it describes how to set the path of directories that Visual Studio looks in for project files and Dlls.
VC++ Directories, Projects, and Options Dialog Box[^]
Referencing an unmanaged Win32 DLL is different. You must use Interop.
Consuming Unmanaged DLL Functions[^]
A better solutuion would be to use the Type Library Importer to convert your Win32 DLLs to assemblies, which can then be used in a managed project as if they were .NET assemblies.
Type Library Importer[^]
|
|
|
|
|
ok i want to know the way how can i get the list of items shared on any computer. i want my application to search the network for available items or shared folders files on network that are accessible
|
|
|
|
|
Hi there,
I just need some help in regards to how to change the row color of a dataGrid based on a specific value? I have a dataGrid reading in some information from an XML file. Each row representing a single entry which includes a date. What I want to be able to do is change the text color or row color, for say all entries containing today's date? How can I do this? Help!
btw: I'm using Visual C++ .Net
Any feedback you can provide will be greatly appreciated!
|
|
|
|
|
I can't find any setting for the collor. If you realy need grid control, try looking internet for alternative grid. or Use ListView Control. With ListViewItem you can change for BackColor or even Font(I think).
PS: Sorry for my poor english
|
|
|
|
|
I'm having a problem with including the pthread.h as I would like to complete several tutorials, such as :
http://www.llnl.gov/computing/tutorials/pthreads/#CreatingThreads
or
http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
The pthread.h is located in stlport directory (Borland C++ 6), including it with #include <stlport/pthread> seems to work but then I'm getting an error message within the pthread.h itself on the line :
# include _STLP_NATIVE_C_HEADER(pthread.h)
[C++ Error] pthread.h(26): E2209 Unable to open include file 'oldstl/pthread.h'
when I copy the pthread.h file into oldstl directory
I get a different error at thesame line within pthread.h
[C++ Fatal Error] pthread.h(26): F1005 Include files nested too deep
I have searched for the sollution to this for 2 days now with no luck
I hope someone is able post sollution to this problem or a step by step instructions on how to include this file.
|
|
|
|
|
firstly comfirm thst the functions is in the file you just included;
secondly had you set the environment apth before? do it
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
You can't just move header files in libraries around, you need to make sure you're able to see them ( that their folder is in your lookup path, or you've explicitly stated the path to the file ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you for the answer, I'm a total beginner but would like to figure this out.
I have set the path with :
C:\program files\borland\CBuilder6\include\stlport;
I added that line to path under Enviroment Variables in computer properties.
The path is clearly added (when I type path in command box its there)
But I still get the error that pthread.h cannot be opened
Edit :
Nevermind, I found it
|
|
|
|
|
You need to do add it to the Include path in Visual Studio.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I was doing my homework, which consists of defining a bunch of terms...
Is there some way to write a program that takes values from a cell and searches on google "define x" and then prints the value in another cell?
or it doesn't have to be a cell but maybe just a text document?
could someone help me out with where to start? how do you go about calling a webpage within a program? will it work with c++?
thanks for all your help.
|
|
|
|
|
Anonymous wrote:
could someone help me out with where to start?
The starting point would be the COM interface exposed by Excel. I'm sure it can do what you want. Launching a browser with a google URL is also easy, ShellExecute will do that. The hard part would be to take a list of URLs and from that get a meaningful value to pass back into Excel.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i could help u out put if u have an Instant messenger SN that would be easy cuz than u or i dont have to wait for replys
my AIM SN = KilroyWasHere00
|
|
|
|
|
public ref struct PointRef
{
PointRef()
{
runTime = 0;
ampl = 0;
}
PointRef(unsigned long runTime_, unsigned long ampl_)
{
runTime = runTime_;
ampl = ampl_;
}
PointRef(PointRef const % src)
{
runTime = src.runTime;
ampl = src.ampl;
}
unsigned long runTime;
unsigned long ampl;
};
void main()
{
List<PointRef^> errList(numPts);
List<PointRef^> errListCopy(numPts);
for (int idx = 0; idx < numPts; ++idx)
errList.Add(gcnew PointRef(idx, idx));
errListCopy.AddRange(%errList);
if (Object::ReferenceEquals(errList[0], errListCopy[0]))
{
int i = 0; // Never gets here
}
int b = 1; // Set breakpoint here
}
When I get to the breakpoint b=1, I look in the debugger watch window for errList[0] and errListCopy[0]. The addresses for the two are different. When I change the ampl value for either object, the other object changes as well. This acts correctly because the AddRange is copying the references so both lists should be pointing to same objects. My question is why does the ReferenceEquals return false because they refer to the same instance and why do the references have different addresses?
Thanks, Charlie
|
|
|
|
|
ChuckStar wrote:
List<pointref^> errList(numPts);
List<pointref^> errListCopy(numPts);
for (int idx = 0; idx < numPts; ++idx)
errList.Add(gcnew PointRef(idx, idx));
errListCopy.AddRange(%errList);
You have two lists here. They contain the same data because you copied one to the other. At least, I think that's what the last line does, and the % is a typo. Either way, there is nothing here to suggest that they are both the same list, just two lists of the same items.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your response Christian. You are correct about the lists containing the same data. To be exact, they contain the same instances of the data. That is what the AddRange function says it does. Copy the contents of the list. The contents are references to objects. As I stated, if I change the ampl member of errList[0], errListCopy[0] gets the change too. This shows that they refer to the same instance as the documentation states. The % is not a typo. This is .NET Beta2 code and the errList is on the stack and the AddRange function takes a reference (^).
If you have any other suggestions, I would like to hear them. Thanks.
Charlie
|
|
|
|
|
You've got two lists that contain the same data. It seems to me that referenceequals would return true if you had two copies of the same list class instance, rather than two instances of the list class with the same objects in them.
But I'm guessing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
try this:
errList[0]->Equals(errListCopy[0]);
ps: i can't compile, but when i use string compare i found that this method work.
|
|
|
|
|
I tried this also with the same result. The problem with this equals is that Object.Equals is a comparison of the references if the object is a reference, but derived classes can change this to a value equality (see the documentation for more details). It is better to use the ReferenceEquals to ensure you are really determining if the references are refering to the same instance of the object. This is very confusing.
The only things I didn't have in my code to make it compile is:
using namespace System::Collections::Generic;
at the top of the file and
int numPts = 100000;
at the top of main.
Actually I just tried this on another machine and it worked. I am using the .NET Beta2 and I may have an older install on the other machine. I will try it again on that machine and let you know.
Thanks, Charlie
|
|
|
|
|
I figured out one problem. That is why the ReferenceEquals is returning false. Somehow, my compile switch got changed to /02 (optimization = Max speed). If I change it to /Od (Disabled), the ReferenceEquals returns true. This seems like a defect in the compiler. I will submit this to Microsoft.
I still don't understand the debugger watch window showing different addresses for the errList[0] and errListCopy[0] references though.
Thanks all for the comments.
Charlie
|
|
|
|
|
Hello Charlie
I tried both Debug and Release builds. It works as expected for me.
Here's my Release build compiler command line :-
/O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /FD /EHa /MD /Yu"stdafx.h" /Fp"Release\Test_Del.pch" /Fo"Release\\" /Fd"Release\vc80.pdb" /W3 /nologo /c /Zi /clr /TP /errorReport:prompt /FU
void main()
{
int numPts = 10;
List< PointRef^ > errList(numPts);
List< PointRef^ > errListCopy(numPts);
for (int idx = 0; idx < numPts; ++idx)
errList.Add(gcnew PointRef(idx, idx));
errListCopy.AddRange(%errList);
if (Object::ReferenceEquals(errList[0], errListCopy[0]))
{
int i = 0;
Console::WriteLine("here");
}
int b = 1;
}
I am using VS.NET Beta 2
Regards,
Nish
|
|
|
|
|
How is that possible? PointRef is a ref struct, errList[0] and errListCopy[0] should get boxed into two different objects, right?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|