Hi All,
I am calling C dll in macro which converts Unicode data to 8 bit encoding data
' Prototype of C function.
' extern "C" int _stdcall Uni2Eni(wchar_t * uni, unsigned char * eni, int size)
'Here is the function where creating alias of C function using C dll(capi.dll)
' ByVal Uni As String ( Its a Unicode string)
‘ByVal eni As String ( its a Non_Unicode string)
Declare Function UNI2Eni Lib "capi.dll" Alias " Uni2Eni " ( ByVal Uni As String, ByVal eni As String, ByVal iSize As Integer) As Integer
Sub Test
Dim iRet as integer
Dim sEni as String
iRet = UNI2Eni(“क”,sEni,40)
End Sub
On calling this function it return iRet =1 which shows conversion has been successful but the value returned in sEni is showing blank .
Is it the problem with data type or something else?
Please anyone can help me?.
I have used the same dll in VBA its gives right output.
I am using open office 2.0.
Problem with Return Value while calling C function?
Re: Problem with Return Value while calling C function?
try replacing by
Code: Select all
Declare Function UNI2Eni Lib "capi.dll" Alias " Uni2Eni " ( ByVal Uni As String, ByVal eni As String, ByVal iSize As Integer) As Integer
Code: Select all
Declare Function UNI2Eni Lib "capi.dll" Alias " Uni2Eni " ( ByRef Uni As String, ByRef eni As String, ByVal iSize As Integer) As Integer