Page 2 of 3
Optional parameter not recognized
Posted: Fri Aug 31, 2018 9:40 am
by robert
Mathias,
In which scenario do you need to use CCALLNATIVE ?
Technically we could implement that like PCALLNATIVE but it is usually not necessary because there are usually other ways to achieve the same result.
Robert
Optional parameter not recognized
Posted: Fri Aug 31, 2018 10:10 am
by Kromi
Hi Robert,
we use this function for communicating with 3rd party components like card readers and an LDAP library.
To be honest, I have no idea if we can replace CCallNative where we use it.
Mathias
Optional parameter not recognized
Posted: Fri Aug 31, 2018 11:29 am
by Otto
OK. I have found MY error.
I had typed
METHOD Constructor( param1 as string, param2 := "" as string)
and the error message was on the call to a constructor with 1 parameter which resulted in the error "can't find constructor with 1 parameter".
I should have typed
Constructor( param1 as string, param2 := "" as string)
Sorry for the inconvenience.
Is it an option to create an warning on the use of the word Constructor if the word method preceeds it or something like that?
I wonder how many METHOD Constructors without parameters I have created...
edit: none B)
Optional parameter not recognized
Posted: Fri Aug 31, 2018 12:07 pm
by Chris
Hi Matthias,
Kromi wrote:Hi Chris,
the scenario is important for me because I'm evaluating the transition of a huge Vulcan.NET solution to X#. Since I get some errors from the X# compiler that I can't resolve yet (e. g. calls to CCALLNATIVE) in a base project, my plan was to reset this project back to Vulcan.NET in order to be able to evaluate other projects that depend on the base project.
Mathias
I think the error you are seeing when calling the x# library from vulcan is a kind of dll mismatch problem, probably vulcan in VS "sees" an older version of the X# dll. Please try a Clean Solution, then Rebuild All, I think it will compile fine now.
Chris
Optional parameter not recognized
Posted: Fri Aug 31, 2018 12:36 pm
by Kromi
Chris,
Cleaning, deleting bin and obj directories and rebuilding did not help, the error is still there.
If I change the signature of the called constructor in a way that there's no cast any more, the compiler is happy. If I add the cast again, the error returns.
Mathias
Optional parameter not recognized
Posted: Fri Aug 31, 2018 12:47 pm
by Chris
Hi Matthias,
Kromi wrote:Chris,
Cleaning, deleting bin and obj directories and rebuilding did not help, the error is still there.
If I change the signature of the called constructor in a way that there's no cast any more, the compiler is happy. If I add the cast again, the error returns.
Hmm, this is very strange, normally this should not be making any difference in this code, I just checked the generated IL with and without the cast and it is identical. Just now I realized you said you are using an older X# build, can you please try again with the newer?
Chris
Optional parameter not recognized
Posted: Fri Aug 31, 2018 1:00 pm
by Kromi
I think I'm using the newest one that is publicly available. But I'll try again as soon as 2.0.0.4 is available.
Mathias
Optional parameter not recognized
Posted: Fri Aug 31, 2018 1:28 pm
by Chris
Kromi wrote:I think I'm using the newest one that is publicly available. But I'll try again as soon as 2.0.0.4 is available.
Mathias
OK, I will install the build you're using and test also with it and will tell you if this is what makes the difference.
Chris
Optional parameter not recognized
Posted: Fri Aug 31, 2018 1:49 pm
by wriedmann
Hi Chris,
I was able to download the solution as I have both the latest Vulcan and X# 2.0.0.4 in my Visual Studio 2015: the error is present also in this version:
Code: Select all
Severity Code Description Project File Line Suppression State
Error 'InheritedXsharp.ClassWithCtor{ STRING }' : no constructor that accepts these argument types VulcanReferencingXsharp C:DevNETtempVulcanReferencingXsharpMyClass.prg 16
If I can do something to help please let me know.
Wolfgang
Optional parameter not recognized
Posted: Fri Aug 31, 2018 5:27 pm
by Chris
Thanks Wolfgang!
Guys, do you get a warning from MSBuild that there is a mismatch between the platform of the vulcan runtime dlls (x86) and the platform target of the X# app (AnyCPU)? This should be displayed, but for some reason it doesn't and this makes me believe something has gone off in the solution and it does not get fixed with a rebuild either, I could fix it only with a Clean. Wolfgang, please try deleting all .dll/.exe files from the solution, then select rebuild all, does it make any difference?
Chris