I'm working in a Com Server DLL where I use requests to make POST a multipart form along with some XML file.
Localy, it works great and with no error. I can call the COM object methods and it returns me what I'm expeting to.
Now, when I use py2exe to build a dist version of the app, and try to register the DLL Com Server with regsvr32, I get the following error:
"Runtime Error!
...
R6034
An application has made an attempt to load the C runtime library incorrecly.
..."
Also, I've noticed that if I remove any reference to the requests library in my python code, I don't get this issue (obviously, I've lost the main functionality of the module).
I tried distributing the C runtime DLLs with the manifest solution in every possible flavor. Also installed the runtime from the microsoft redistributable installer. No effects whatsoever. I'm possitively sure that it's got nothing to do with the runtime itself.
Made virtual machines with W7 and XP, for testing purposes. I can register the Com server with regsvr32, but the error occurs when calling the method.
However, if I comment the line where I make the POST with the request lib, or if I call another method where request is not involved, no errors occurs and everything seems to be working fine. Of course, the key functionality of the COM is lost, since everything revolves around the request lib. And I sincerely don't want to use the primitive urllib lib...
My conclusion: seems to be something with py2exe and the request lib. Some dependency has to be missing. Although I can't figure what or why, since py2exe seems to be packing everything...
Never before has any problem distributing COM servers with py2exe.
Has anyone had any similar problem with py2exe and requests???
Seems very similar to py2exe com dll problem. Perhaps its just a matter of packaging the C Runtime DLL, or installing the Visual C++ 2008 Redistributable on the machines you are deploying to.
Related
I am currently trying to basically expose a native C++ library, that I not have the code for, as a WebApi. To do that, I created a managed C++ wrapper library, that allows my web application to communicate with the native code.
So the dependencies of the project look something like this:
Web application (ASP.NET)
Managed C++ Wrapper
Native C++ Library (DLL)
Native Dependencies (DLLs)
My problem is now, that I always get the error message "Could not load file or assembly [ManagedWrapper.dll] or one of its dependencies. The specified module could not be found."
Since the managed wrapper library is in the same solution, it is listed as reference and even copied to the shadow copies, so I assume that the problem lies in the native dependencies. I am well aware that there are problems with loading native DLLs in ASP.NET as no shadow copies will be made of them and they can not be added to the GAC. I tried to tackle this problem by just adding them to my %PATH%, but the error still remains. Dependency walker did not show any additional dependencies and adding the native DLLs to system32/inetsvr fixed the problem, but this is obviously not the way this should be done.
So here my question: What could be the reason that the PATH variable is not working? (And is there maybe another way to get this to work?)
Using loadLibrary to load with an absolute path is not really a possible solution as I have no influence on the native C++ library and how it will load further dependencies.
I think I found my own a solution to my problem and hope this might help someone else as well:
My native DLLs where somewhere in my home folder. Moving them to a more accessible place, i.e. C:\temp\, and adding this folder to the path seemed to do the trick. My guess is, that this was a permission based problem, even though I added rights for IUSR for that folder in my home directory before.
I am having trouble getting Inno-Setup to load my DLL.
I have looked at similar posts, but none of the solutions offered in those seem to help.In particular, this post came very close, but does not seem to be quite the same issue.
My installer runs just fine on my test system. My DLL is written in C++, using VS 2010. There is a DEF file. I have been successful using the VS debugger to attach to the installer's thread and step through my code. Everything is good. The release version runs just fine on my test system with no debuggers involved. Setup calls my DLL and it works.
Then I take my installer to a different, pristine system to try it out. Every time, when I launch the installer, it starts off with the usual UAC prompt: "Do you want to allow the following program from an unknown publisher to make changes to this computer?" And I say "Yes." Then I get a beep and an alert that says:
Runtime Error (at -1:0):
Cannot import
dll:<utf8>C:\Users\Logicrat\AppData\Local\Temp\is-4E245\MyDLL.dll
In my setup script I have
[Files]
Source: "MyDLL.dll"; DestDir: "{app}"; Flags : dontcopy
and
function MyFunc(hWnd: Integer; lpText, lpCaption: AnsiString; uType: Cardinal): Integer;
external 'MyFunc#files:MyDLL.dll stdcall setuponly';
According to the Inno documentation, the dontcopy flag is appropriate if the DLL is not needed for uninstall, which it is not.
I suspect the problem lies in designating exactly where the DLL is supposed to be, as I my script calls for it to be in the {app} directory, yet the error message refers to a temp directory. I've tried a number of variations of the script, all with the same results.
Both my development/test system and my pristine target system are Windows 7 (32-bit). I have been banging on this for weeks with no visible progress. Any suggestions will be most welcome.
Problem solved, thanks to the suggestion by TLama about checking dependencies. When I had initially created the new project for my DLL in MS Visual Studio 2010, I had selected the option to "Use MFC in a shared library." That turned out to be the source of the problem, as the DLL itself was then dependent on mfc100u.dll and msvcr100.dll, which were not present on the target system I used to test my installer. I fixed it by changing the project preference to "Use MFC in a static library." That made the DLL larger, but it also made it work. Then, after I first rebuilt the DLL and then rebuilt the installer that used it, everything was fine.
It might have been nice if the error message I got the first time around named the DLL it was looking for instead of the DLL that tried to call the missing one.
I have developed a Java applet that loads my C++ dll through the loadLibrary function. From there, my applet calls some native methods that are implemented in the C++ code. I have created an InstallShield installer that puts the C++ dll in the required location on my client computers.
Everything works just fine on my development PC, but when I try testing on a "fresh" client computer that does not have anything but the JRE installed, I am getting an UnsatisfiedLinkError: Can't find dependent libraries. I don't know if there is something else I need to include. I checked using DependencyWalker and below is what I saw.
Is there anything out of the ordinary that a fresh windows install would not include? What else can I do to determine what dependency my dll cannot find on the client?
I have a pretty annoying compiling problem.
I am trying to do a System.loadlibrary on a C++ DLL in VS2010, which in turns uses a C DLL compiled in VS2008.
The error I am getting is:
java.lang.UnsatisfiedLinkError: The application has failed to start because
its side-by-side configuration is incorrect
This occurs whenever my C++ DLL tries to do a call to a function in the C DLL. Both compiles just fine, and both are in a folder accessible by Java Applet.
Is this possible to solve somehow? Do you need any more info?
You should try and use the dependency walker on your DLLs.
From the side-by-side error I assume that one of the c runtime redist packages or one of the noredist packages is missing.
But the dep walker should show you this.
If this does not help you can get some more information from the event log of Windows since side by side errors are logged there, or you need to use sxstrace for more info.
Have you installed the runtimes of VC2010 and VC2008?
Additionally you have to make sure the manifests of both DLLs are correctly configured so that the correct version of the used library can be loaded.
See also: http://msdn.microsoft.com/en-us/library/ms235342.aspx
I am building a project in VS2005 and several of my DLLs are failing to register. The error message I am getting in Visual Studio is:
Project : error PRJ0019: A tool returned an error code from "Registering ActiveX Control..."
which is nicely vague. When I register the DLL manually through the command line (using regsv32.exe, I get the following error:
LoadLibrary("test.ocx") failed - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem.
I ran Dependency Walker (depends.exe) on the culprit .ocx file but it isn't showing any obvious problems.
I have also done a re-build but I'm still getting the same problem.
Any suggestions as to how I could determine the cause of this failure to register?
Microsoft had recently released a Security Update for ATL (KB971090). It is un update on top of MSVS2005sp1 and it's both compilate-time and runtime compatibility breaker. Check if your building environment has this patch.
References:
ATL Security Update:
http://msdn.microsoft.com/en-us/visualc/ee309358.aspx
Breaking changes in ATL:
http://msdn.microsoft.com/de-de/library/ms235654.aspx
And this is a must read:
http://tedwvc.wordpress.com/2009/08/10/avoiding-problems-with-vc2005-sp1-security-update-kb971090/
Most probable is because the embedded manifests. You should take a resource explorer application and check your DLLs for the embedded manifests. It might be that one of the dependent DLLs (or your DLL) require some versions of other DLLs which don't exists.
I got this message: "This application has failed to start because the application configuration is incorrect." in case of embedded manifest mistmatches.
Probably the easiest way to troubleshoot this whole category of problem is to install Process Monitor from microsoft.com.
Process Montior lets you observe the system calls processes are making, and in this case you will be able to see if some system call is failing. For example, if you are lacking a dependency, then a CreateFile() call will be seen failing with a DLL, OCX, etc. as the filename.
Launch procmon and configure the filter to exclude events other than from regsvr32.exe, reproduce your test case, and then check the log. Look for NAME_NOT_FOUND errors in the return value column.
Do you have the C++ Redistributable Package Installed?
There are several things you can try:
try regsvr32 w/ fusion log enabled (fuslogvw.exe - it works for unmanaged dlls as well). This would give you a bit more information than depends on what external dependencies are loaded, where are they loaded from and what errors were hit.
copy the .ocx and its dependencies to the root or a first level folder and try registering from there. I don't remember details, but there was an old problem with registering a COM dll from within too deep of a path.
run regsvr32 under WinDbg. Set a breakpoint DllMain and see if it does anything funky.
If you never break on DllMain in WinDbg, set a breakpoint on module load for your dll and once it's hit, you can either step through LoadLibrary, or just set a generic load library breakpoint and check every dll after that.