Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get the error: method 'PolCoefCalc' not emitted because of invalid return type or parameter type when I make a VB6 DLL and use the DLL in VC++.

Our VB6 source code is as following:
Dim xArray(60) as double
Dim YArray(60) as double
Public Function PolCoefCalc(ByRef pT() As Double, ByRef pU() As Double, ByRef pA() As Double) As Double
Dim resultA As Double
'1 pT=y copy this array elements to our internal array i.e. yArray
DataPoint = pN
'for insert data of 'pT' array from->to 'Yarray'
For i = 0 To DataPoint
Yarray(i) = pT(i)
Next i
'for insert data of 'pU' array from->to 'Xarray'
For i = 0 To DataPoint
Xarray(i) = pU(i)
Next i
'finally copy the result in pA array
For i = 1 To DataPoint
pA(i - 1) = xarray(i)
Next i
resultA = 0
PolCoefCalc = resultA
End Function


Kindly provide the solution and could you explain why VC++ does not show the 'PolCoefCalc' method and instead shows the error message.
Posted
Updated 18-May-10 2:13am
v3

1 solution

VB6 arrays are different from C/C++ arrays:


    • in VB an array of Double is treated as an object, they knows their size, and they are bounds checked

    • in C/C++ an array of double is just a memory area with the right size required to store as many numbers as declared, and accessed by pointer. The runtime does not keep trace of the array size, and it's responsibility of the programmer to avoid buffer overruns



When you use a VB6 dll from VC, Visual Studio will create a wrapper for that dll, but in your case it give you an error message because it is not able to create a C/C++ function equivalent to the VB6 one.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900