Run an unmanaged class from .NET.

I find many examples with Google on how to call an API function in an unmanaged DLL from .NET code, but how do I instantiate an object from this unmanaged code?

I am currently working on an old obsolete application (and I’m not yet convinced that we can do something about it, but we need to bother and research) that the company wants to switch to. NETWORK. It looks like it was done before, and now I am looking through it. The most common compilation errors are links to old DLLs that the project does not understand.

An example line of code in this case:

Dim cAccounts As HSVMETADATALib.HsvAccounts

There is a broken link to the library in the project, which, in my opinion, is the result of some attempt caused by the wizard to simply port some pre-.NET project to .NET. I have the DLL he is looking for, but adding a link to it returns an error:

Link to "HFMConstants.dll" could not be added. Ensure that the file is accessible and that it is a valid component of an assembly or COM.

Now I do not know anything about this DLL. And I have very little experience in programming Windows to .NET. So I was looking at information about using the old DLL in this code, and all this focuses on calling API functions in the DLL. However, looking at this code, it is much less about API functions and much more about objects. So, how can I instantiate one of these objects?

( , , , , , , , DLL, , , , , .)

, :)

+3
3

DLL. , COM-, , tlbimp.exe. Win32, , , , PInvoke . dumpbin.exe, .

+1

, , , .

If you have a .dll and all .dll dependent on it, you can add it to your project links. If not, without external documentation, it's pretty hard to understand what this compiled code does.

0
source

Source: https://habr.com/ru/post/1760591/


All Articles