DLL import in C #

0

I joined a recent project that uses a nearby printer to print tax coupons.

The last one who worked on the project used a DLL (if I'm not mistaken in C ++) that managed the printer.

In the project, this DLL is imported through the following command:

[DllImport(@"C:\InfoSAT\ptptrpro.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern Int32 SetProtocol(Int32 protocol);

When attempting to execute the imported method, I am thrown a System.DllNotFoundException stating that the specified module could not be found.

I found this error curious because in the folder informed in Import has this DLL.

My guess is:

This DLL can be corrupted (difficult, but not impossible);

3 - Another thing I could not imagine.

Thanks to anyone who can help me.

    
asked by anonymous 23.12.2016 / 19:33

1 answer

2

It may be that one of the dependencies of the dll you are trying to reference is not being found.

A good program to check for dependencies on dlls is DependencyWalker that will list you the dependencies of the dlls and which ones may be missing.

    
23.12.2016 / 19:54