D
D
Daniil Demidko2016-12-03 09:01:19
C++ / C#
Daniil Demidko, 2016-12-03 09:01:19

Why can't I connect an unmanaged dll?

I'll give you a simple example.
There is the following C++ library:
b0a5e51cc0954b529b4fdecd02e85631.png
And there is a C# code that uses it:
43b406df63294bf8b9d84e6f11718689.png
And here the magic begins:
When the C++ library is compiled with VC++, everything works fine, but through TDM-GCC it throws an exception (on the screenshot).
But when I change the target platform from .NET 4.6.2 to .NET 4.0 in the C# project settings, everything starts working with the library compiled via TDM-GCC.
How can this behavior be explained?
How can I include a TDM-GCC compiled library in a .NET 4.6.2 project?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sumor, 2016-12-03
@Daniro_San

Look at the bit depth of the library and C# program.
The C# program, if nothing is changed, runs under x64. TDM-GCC most likely compiles for x86.
Link libraries must match the program from which they are called.
Convert everything to x64 or x86.

V
Vyacheslav Zolotov, 2016-12-03
@SZolotov

charset specify ASCII

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question