Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I took sample codes from "Calling All Stations[^]"
to build my own CPP DLL and C# application. The application and DLL were built successfully. I used tools, sigcheck, dumpbin /headers, to confirm the application and DLL are both 32-bit ones.
Unfortunately, the error (HRESULT: 0x8007000B) occurred while DLL being called by the application.
I checked almost every aspect to confirm that both ones are 32-bit. I wonder what I can do to check the miss to figure out the trouble. What can I do to work it out?
My IDE is Visual Studio 2019.

What I have tried:

I googled lots of articles talking about 0x8007000B and used tools; such as sigcheck, dumpbin /headers to check it and found no cause.
Posted
Updated 1-Feb-21 5:40am
Comments
Shao Voon Wong 1-Feb-21 4:55am    
Make sure the dll is inside the executable directory and the calling conventions are the same.
Stan Huang 1-Feb-21 5:04am    
Yes, I did check the folder of DLL and application is the same. Calling-convention is assured too.
Shao Voon Wong 1-Feb-21 5:22am    
Did you try to return a char* as string to C#?
Stan Huang 1-Feb-21 5:43am    
I failed at the first calling. It's an 'int' return type function without any parameter. So, I think there is no issue as you said.
Richard MacCutchan 1-Feb-21 5:17am    
I just built these projects in VS2019 with no changes, and it works fine. Could you find out exactly where the error occurs and let us know?

1 solution

Check that the C# app and its components are also 32 bit executables. Sounds like you have this issue: .net Framework Error (HRESULT 0x8007000B).
 
Share this answer
 
Comments
Stan Huang 2-Feb-21 6:03am    
That issue is different from mine, just similar. They don't really propose a solution.
Shao Voon Wong 3-Feb-21 2:09am    
Write a simple project to reproduce the problem and upload it to GitHub and I'll take a look.
Stan Huang 3-Feb-21 6:40am    
I'm considering building both (C# application / C++ DLL) in 64-bit. I built the 64-bit application successfully. But I failed to do it for DLL. I changed its property page's Target Machine option to x64, then re-built it. I got the error: "fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'"
How come? What should I do to build a 64-bit DLL?
Shao Voon Wong 4-Feb-21 1:44am    
Your C++ DLL project probably does not have x64 profile. Open the Configuration Manager to create one.

https://imagizer.imageshack.com/img924/5964/dfmqgh.png

You have to figure out how to use the configuration manager. Teaching you would take me many screenshots. Configuration manager can also show if your C# application is AnyCPU or true 32-bit. Good luck!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900