Consider this:
In our X #DLL which we call from VO, we have this function:
METHOD DoSomething(n1 as dword) AS DWORD
LOCAL n1 AS DWORD
DoSomethingElse()
RETURN n1
From VO we call it like this:
oXS:= OLEAutoObject{"IC2ExtLibForVO.VOVulcanClass"}
IF oXS:finit
oXS:DoSomething(1)
This ends up in a run time error if we leave out the parameter in red (and assign n1 locally as in green); the catched error message says that the number of parameters is incorrect. n1 has no function. If we pass the parameter in red, it works.
Why does the call to a X# method from VO require a parameter?
Dick
Why does a call to a X# DLL from VO require a parameter?
Why does a call to a X# DLL from VO require a parameter?
Hi Dick,
probably the OLE method you use in VO defines that there is one int parameter.
Wolfgang
probably the OLE method you use in VO defines that there is one int parameter.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Why does a call to a X# DLL from VO require a parameter?
Hello Wolfgang,
That's what I call a quick reply!
But I'm not sure where you are referring too. DoSomething is the method (in the X# DLL) I call. It works with 1 parameter and also with >1. Only not with 0 (with or without parenthesis) . I'm not sure what this has to do with the VO defines?
Dick
That's what I call a quick reply!
But I'm not sure where you are referring too. DoSomething is the method (in the X# DLL) I call. It works with 1 parameter and also with >1. Only not with 0 (with or without parenthesis) . I'm not sure what this has to do with the VO defines?
Dick
Why does a call to a X# DLL from VO require a parameter?
Dick, I suspect you have enabled the /vo5 (implicit CLIPPER calling convention) option in your X# library? This will make the method under the hood actually have one hidden parameter, this is important for implementing CLIPPER calling convention. To make sure you avoid this, no matter the compiler options, just explicitly define the method as STRICT:
METHOD DoSomething() AS DWORD STRICT
METHOD DoSomething() AS DWORD STRICT
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Why does a call to a X# DLL from VO require a parameter?
Hi Dick,
your X# library is used in VO via COM.
To call it from VO, you have generated an interface class. In this class, every method defines the number and type of variables:
If you change the code on the X# side, you must regenerate the code also on the VO side, or at least adjust it (Normally, I do the latter).
Wolfgang
your X# library is used in VO via COM.
To call it from VO, you have generated an interface class. In this class, every method defines the number and type of variables:
Code: Select all
METHOD Process(;
cSubject,; // AS STRING
cMailBody,; // AS STRING
lIsHTML; // AS LOGIC
) CLASS ISmtpSender
LOCAL oMethod AS cOleMethod
LOCAL uRetValue AS USUAL
oMethod := cOleMethod{}
oMethod:symName := String2Symbol("Process")
oMethod:iMemberid := 105
oMethod:wInvokeKind := INVOKE_METHOD
oMethod:nParams := 3
oMethod:lNamedArgs := TRUE
oMethod:cParamTypes := VTS_BSTRW + VTS_BSTRW + VTS_BOOL
oMethod:bRetType := VT_BOOL
uRetValue := SELF:__Invoke(oMethod, DWORD(_BP+16),PCount())
RETURN (uRetValue)
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Why does a call to a X# DLL from VO require a parameter?
Hello Chris Wolfgang,
Thanks for the replies. Indeed adding STRICT solved the problem! Now it works without parameter.
Dick
Thanks for the replies. Indeed adding STRICT solved the problem! Now it works without parameter.
Dick