Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Micros SIM

Status
Not open for further replies.

fsalinas

Systems Engineer
Oct 3, 2019
13
PR
Trying to link a DLL with a RES Sim module (3700)

The DLL was done using C# (Visual Studio)

The SIM part is as follow:

event inq : 200
var controlNumber:A8

window 5, 50 // generate window to display at most ten items

var dllHandle:N12
DLLLoad dllHandle, "microsIvuControl.dll"
display 1, 1, "Entering: ", dllHandle

if (dllHandle = 0)
display 2,1,"Error al cargar Libreria Micros"
waitforclear
else
controlNumber = "000-0000"
DLLCall dllHandle, Test(2000, 2, 14, 0, 1, 123456, 1, ref controlNumber)

display 2, 1, "Valor de retorno: ", controlNumber
waitforclear "No detail items"
DLLFree dllHandle
endif
endevent

And the C# code is:

static string microsDir = @"c:\Ycs\YcsFiscal";

[DllExport("Test", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
//public static void Test(int amount, int munTax, int stateTax, int redTax, int tender, int chk, int tipoTran, out string controlNumber)
public static void Test(int amount, int munTax, int stateTax, int redTax, int tender, int chk, int tipoTran, ref string controlNumber)
{
string msg = $"Requerimiento de numero de Control IVU. Amt: N1={amount}, munTax={munTax}, StateTx: {stateTax}, Reduced Tax: {redTax}, Tender: {tender}, Tipo: {tipoTran}";
//File.WriteAllText($"{microsDir}\\Log\\Fiscal.log", msg);
controlNumber.Append("XXX- }

At run time, the SIM module get a valid handler for the DLL, but print the ref variable: controlNumber with a garbage value. I had included the result of the Sim execution.

I had address the problem is in the string that is expected to be returned by the DLL function TEST.It return a garbage string instead of the expected "XXX- value


micros_rsdggn.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top