Difficulties with Dll import C #

1

I'm having a hard time rewriting a method of a dll in C #, we bought a price checker from a manufacturer, in case it provides a dll and a sample code in Delphi.

This dll has some functions among them to start the service with the reader, to read the data, to check which equipment is connected, etc. In case I want to transform this method:

function bReceiveBarcode(var stAddress; var BarCode: PChar): Boolean; 
stdcall; 

In a method available in C #, so I tried to create this method:

[DllImport("VP.dll", EntryPoint = "bReceiveBarcode")]
private static extern Boolean bReceiveBarcode(ref stAddress, ref string barcode);

In case stAddress is a struct, I'm trying to use this method in my application, but the Identificador esperando error appears as if the first parameter were wrong.

    
asked by anonymous 23.10.2017 / 12:24

1 answer

2
  

It's like the first parameter is wrong.

It is wrong, you need to set the parameter type.

[DllImport("VP.dll", EntryPoint = "bReceiveBarcode")]
private static extern Boolean bReceiveBarcode(ref object stAddress, ref string barcode);
    
23.10.2017 / 13:13