Anyway, her's the situation:
We have a Win32 application written in Clarion for Windows. This dev tool produces standard Win32 binary similar to C++. The Clarion Compiler is actually a C++ compiler as well as compiling Clarion code so the result is the same
We allso have a large .NET library we want to utilize in this Clarion software. But since Clarion is not .NET compatible or is able to compile managed code, I had to figure out what to do. The answer was quiet simple actually. C++/CLI was what I was looking for. I then created a small C++ DLL that wrapped my .NET library. This works perfectly and everyone is smiling......until we installed the software on our Windows 2003 Terminal server..... DANG!! Error 0XC0000005!! The Error shows at loading time, before any code is started at all. And of colurse, both FW4 and VC100 is installed...
As I said here: "The error shows at loading time", hence, no code is started yet. Let me explain the flow in my program:
All DLL's are loaded by the OS. This I know becuase if some DLL's of mine is missing I will be told.
Next, the program do lots of initialization of databases and stuff and User is presented a Login dialog
User loggs in. I then checks the settings for this user if he/her has a license to use my .NET components. If the user have this license, the API in the DLL is called and presents the user with a GUI created in C#
Now, since the absolutly first call to my C++ DLL is done AFTER the login, then I am pretty sure no code has run in front of the error.
An argument against this would of course be if the C++ DLL had some constructors of any kind that would be started when the DLL is loaded, but it has none. And of course, if it DID have one, dont you think the error would have shown regardless of the OS?
I am 99% certain that the error is in some missing components in the OS and 1% certain that ther might be a switch setting in my C++ project that is wrong. I must admit, I have NO knowledge of how C++ works. This is my absolute first project in C++ and it contains nearly nothing, other than ONE abstract class (the interface) and one class that inherits the interface. When I call the API I send in a Clarion Interface, wich is binary compatible with an abstract class in C++. Then I instantiate my wrapper class. I then return the interface of the C++ class. This interface has methods that will call the .NET components. This works 100% nive in Win7 and Win2008. Since the problem ONLY appears on WinXP and WIn2003 it tells me that something is missing
My first thought was that the framework was not complete or maybe there was something with the VC100 runtime, but I cant see any missing parts. I know for a fact that running a .NET 4 program on a computer with no framework will result in 0xC0000005 message, just like my problem so therfore I'm 99% certain of the missing parts in the OS
You can test this wery easly. Just create a .NET project with FW4 and try running this on a FW2.0 computer. There are no FW version check at all. Just the error message....
Ole Morten Heien
HD Software / Advisor AS
* Try loading your DLL in Depends (from the Windows SDK) on XP. That will show you if there's a dependent DLL that's not preset on XP.
* Run fuslogvw.exe (part of the .NET SDK) and look for entries related to your Clarion app. It's possible that the .NET loader (fusion) is logging a more meaningful error when your assembly (DLL) is loaded.
* Check the OS event viewer logs. I've had stack traces show up in there sometimes when things aren't loading.
* Try writing a simple Win32 C++ app which loads your DLL and calls a dummy entry point to be sure that it's loadable *at all* on that OS. If not, it's probably a dependency issue like I mentioned above. If it's loadable then clearly it's an interaction with the Clarion app.
* Load your DLL project in dev studio and set the Clarion exe as the debug exe and check the boxes to break for All exceptions under Debug > Exceptions... when the load fails, is there any first-chance excetion triggered preceding the failure? (this one's a long-shot)
* Try using Procmon from sysinternals.com and monitor disk activity. Set the filter to include only you exe process name to remove lots of unrelated output. See if there are failures reported before the DLL load fails.
* Does your exported function happen to call code from another C# assembly you've created? If so, the related assembly may not be getting located properly as .NET searches in the .exe directory, not in the C++ DLL's directory. The first function using a type from the C# assembly can fail unless you've handled the AppDomain.AssemblyResolve event.
ps. I used Clarion back in 1990 or so...was DOS-based then. Wonder if its the same thing.
Hi and thanx very much for this info. I wil test this in time.
I was not avare of that Clarion could be set as the debugging EXE in VS. This was very interresting!!
Clarion for DOS was the first Clarion edition so yes, its the same It has been a little moderized in time, but the language is still the same. I have worked with Clarion since the first release. They are working on a .net edition these days. I have tested it. Works pretty well, but is still in beta. It depends on how long ago since you worked with Clarion. When they moved from DOS edition 2.x to 3.x they allso changed the compiler because Topspeed was incorporated into the company. Since then they have used the Topspeed compiler to compile theyr binaries, and still are.. Pretty amazing product. Today they use #Develop as the IDE and in time they wil incorporate theyr .NET edition into the Win32 edition.
Well, that was the history lesson for today
Anyway - thanx for your effort...
I know you ment the Clarion compiled EXE
Ole Morten Heien
HD Software / Advisor AS
I'm building a "usercontrol" that has a contextmenustrip on it.
All is fine until I try to add an image to an item, it compliles ok but get a runtime error!
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "HexBox.HexEditBox.resources" was correctly embedded or linked into assembly "HexEditBox" at compile time, or that all the satellite assemblies required are loadable and fully signed.
I can only assume that it can not find the resource!
I checked the .resx file and the resource (image) is there.
Maybe it needs the be somewhere else, or a different process is require to use the contextmenustrip on a user control.
I tried the same process on a "form" and as expected all compiles and run as it should.
Using VS2008 Framework 3.5
Any help is appreciated.
Is there any function to create an XML file from Managed C++/CLI code(like System::IO::File::Create(L"Test.ini"); for plain files). I've to create an XML file from Managed C++/CLI code and write the following contents in it.
The XML is stored in a DOM (Document Object Model). Note the Binary Order Mark supression - the UTF8 Encoding set to false. IF you leave this out then a couple of non printable characters appear in position 1:1. It upsets soapclient no end!
Thanks John also about the point which you indicated. Hovewer this time application's all windows are maximised which is actually not much preferable. I guess you already have a better idea to fix
the problem. Let me know please.
It's allright Screen::GetBounds(this->ClientRectangle)
Suprisingly it didn't work well. The width of the forms just became a little smaller.That's all.
The application still has a screen size or resolution problem. I am really confused.
System::String ^ St = gcnew System::String("Hey ho!");
St = str; //This line won't work, but it's what I'd like to achieve
The only way I can make it work is by doing gcnew again St = gcnew System::String(str.c_str()); but I'm guessing this is not the right way. All the examples I have found tell how to do this when creating a new instance of System::String but none how to do it with an existing one.
Last Visit: 31-Dec-99 18:00 Last Update: 30-Sep-23 23:28