
VB.Net Fog is Ambiguous
Posted Thursday, 21 May, 2009 - 19:14 by gareththegeek inI am unable to use the Fog functions in VB.Net in the head revision because of the following compilation error:
'Fog' is ambiguous because multiple kinds of members with this name exist in class 'OpenTK.Graphics.GL'.
I believe this is an issue with VB.Net and C#.Net interoperability, for example:
http://msdn.microsoft.com/en-us/library/ms235408.aspx
Any ideas?


Comments
Re: VB.Net Fog is Ambiguous
The important question here is, which version of OpenTK are you using? Is it 0.9.7 or SVN? This could be an interoperability issue, but not due to case-sensitivity.
Can you post your exact call to the Fog method? The solution could be as simple as a plain cast to the correct type.
Edit: OK, I've managed to reproduce the error. The issue is that VB.Net cannot distinguish between:
C# uses the
refkeyword which allows the compiler to distinguish between those two.One solution is to revert the change and use Fogv and Fog to distinguish between the two. I don't know if it is possible to somehow instruct the compiler which method to use. It seems
[CLSCompliant(false)]is ignored when consuming the assembly, but there might be another way (reading the docs).Any ideas?
Re: VB.Net Fog is Ambiguous
The issues related to Fog functions should be resolved now (SVN 1763+).
I took the butcher's approach of removing all ambiguous overloads. This is a breaking change, but a) affected code is easy to fix and b) these overloads would be broken during the 0.9.7 -> 0.9.8 transition anyway.
Re: VB.Net Fog is Ambiguous
You are correct. The issue is because you do not explicitly specify that an argument is by ref when calling a function in VB.Net and worse there IS no way to do so :(
I guess I've just never got on with C syntax, I used to use Pascal!!
Thanks for sorting this out. I will test out the SVN head revision (to replace my hacked about version where I was renaming things back to fogv, texparameterv, &c)
Re: VB.Net Fog is Ambiguous
Please tell me if you encounter any more problems related to this. If worse comes to worst, it is always possible to revert the change.