gareththegeek's picture

VB.Net Fog is Ambiguous

I 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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

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:

     Sub Fog(ByVal pname As FogParameter, ByRef params As Single)
    Sub Fog(ByVal pname As FogParameter, ByVal params As Single)

C# uses the ref keyword 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?

the Fiddler's picture

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.

gareththegeek's picture

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)

the Fiddler's picture

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.