C # crash while loading C ++ dll

My program is written in C # NET 2.0, it uses external functions from a dll written in C ++ using Microsoft Visual Studio 2008 SP1. If I remove the dll from the directory in which the program is placed, the program will work the moment it should use the dll. This is normal.

But users who use my program get the same error in the same place without moving the dll. All of them have C ++ Redistributable 2008 from > here <

Does this happen because I made the program in .NET 2.0 instead of NET 3.5, or did it because the redistributable version must be an older version?

Edit: mind you, the program is working fine.

→ new thread <<

0
c ++ c # dll crash
source share
5 answers

This is most likely the wrong runtime. Make sure you distribute the correct one. They will always work in your dev block, because runtime is on the way. For software testing, I use a Windows XP virtual machine. I installed the virtual machine as a completely new installation, installed the components that I know I need (.NET framework, etc.), and then run my installer. You will encounter an unexpected amount of tuning problems doing this.

+1
source share

The C ++ redistributable that you linked in a similar way is from the original version of Visual Studio 2008. If this changes with Service Pack 1, I could see that it caused a crash. Maybe there is an updated version of the redistributable that your users should install?

0
source share

There is very little information in your question about the actual accident, which can mean any of many things. In my experience of mixing .NET and native C ++, many problems can arise side by side (SxS), especially if the DLL and .NET application were created with different versions of the compiler.

You probably need to reproduce this problem on your local computer to debug it.

0
source share

Dependency Walker can be excellent for tracking such problems. You can load the DLL into it, and it will tell you if any of its dependencies is unavailable. Sometimes missing .dll files are not necessarily a problem (unless you follow this code path), but this is much better than guessing.

0
source share

There is no difference in this context using .NET 2.0 or 3.5.
Look at the method in which you bind and export functions from C ++ (if it is unmanaged) If external functions were written in managed C ++, look at the signature and version of the dll

0
source share

All Articles