Now, I'm currently trying to receive the multiple return value from DLL in VBA(Excel Visual Basic).
This is my DLL code.
double _stdcall pll_dll(double* datain0, double* datain1, double* dataout0, double* dataout1)
{
dataout0[0] = datain0[0]+10;
dataout1[0] = datain1[0]+10;
return 0;
}
Then I want to give some value to the DLL by using the datain0 and datain1 and receive the dataout0 and dataout1 from the DLL in the VBA(Excel Visual Basic).
This is my VBA code.actually, I'm not familiar with VBA(Excel Visual Basic)
Option Explicit
Private Declare PtrSafe Function pll_dll Lib "F:\work\pll_dll\x64\Debug\pll_dll.dll" (ByRef x_in As Double, ByRef y_in As Double, ByRef x_out As Double, ByRef y_out As Double) As Double
Dim Error As Integer
Dim dat0 As Double
Dim dat1 As Double
Dim dat2 As Double
Dim dat3 As Double
Function pll_dll_excel(data0 As Double, data1 As Double, data2 As Double, data3 As Double) As Double
pll_dll_excel = pll_dll(data0, data1, data2, data3)
End Function
Sub useSquareInVBA()
MsgBox pll_dll_excel(3, 4, Cells(5, 5), Cells(6, 6))
End Sub
What am I supposed to make the function which is what I want to give datain0=3, datain1=4 and receive the dataout0 and dataout1 values?
If I run the above code in the excel, I've got a problem halt
Bookmarks