简体   繁体   中英

C++ app fails to initialize (0xc0000005), when using C# dll

I have a C# DLL, which I call from a native C++ programm. As I use Qt and /clr compiler option did not work I followed this tutorial for a bridge.

So I have a VS2008 project (compiled with /clr), which links to the C# DLL and contains the bridge class and the native class, which exposes interfaces to my C++ programm. Another VS2008 project (no .net stuff) calls the native class (statically linked).

I had some issues, but now the programm at least compiles. However, if I try to run this programm, I get a (0xc0000005) error on initialization, when I try to use the native class. As this happens on initialization, I don't even see, which DLLs fail to initialize. All DLLs should be in the right place.

Any hints? Thank you.

I have a similar issue; Qt with C++ and /clr. I made a wrapper for a managed class and then made the front end with Qt and I get the warnings…

Take a look at this discussion on bytes.com: __fastcall functions in a static lib, cant be called from managed code?

The guy there says that static managed classes compiled with /clr are incompatible with fastcall.

The project, which called the native class was linked statically to my exe and this did not worked. I changed it to a DLL and now it seems to work.

I'll investigate a little more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM