2

I am a VB.NET developer and I was trying to use this library called Raw Input Sharp ( http://www.jstookey.com/arcade/rawmouse/ ) which allows me to receive raw data from multiple mice at once. The library was originally written in C# but due to the fact that I used .NET, it does not matter what the original language was.

I referenced it and got an error saying that the lib had multiple definitions with the same name. After about hours of struggle, I realized that in c# we have case sensitive while the opposite in vb. e.g. The structure RAWMOUSE coincided with the class RawMouse.

What do I do now?

The Amateur Coder
  • 789
  • 3
  • 11
  • 33
Shreyas Kapur
  • 669
  • 4
  • 15

2 Answers2

3

Rename your struct or put it in a different namespace.

Jakub Konecki
  • 45,581
  • 7
  • 87
  • 126
  • 1
    If I understand the question correctly, it's not _his_ struct. – C.Evenhuis May 22 '12 at 09:50
  • @C.Evenhuis - than my answer applies to the class. – Jakub Konecki May 22 '12 at 10:45
  • See if it compiles. The CLR generated is case-sensitive, so it might work. OK, it is a very long shot, but worth trying. :-) – Chiwda May 22 '12 at 10:52
  • @JakubKonecki what I meant is he is using a 3rd party library, maintained by someone else. Even if he has the code, in case of any changes or bugfixes to the class he would have to manually merge them. – C.Evenhuis May 22 '12 at 11:17
  • @C.Evenhuis - I think it's a case of a type from library clashing with a type from his code. There cannot be a problem of two types clashing *within* the library, as the library wouldn't compile in the first place. – Jakub Konecki May 22 '12 at 11:58
  • @JakubKonecki - in C# you can have a `RawMouse` and `RAWMOUSE` class (or struct) in the same namespace which compiles just fine, VB.NET is a case-insensitive language that compiles to a case sensitive CLR and therefore does not allow this. The problem is in the interaction between a C# dll and a VB.NET caller. – C.Evenhuis May 22 '12 at 12:19
  • Agreed with C.Evenhuis solved it by renameing RawMouse to RawMouseClass – Shreyas Kapur May 23 '12 at 07:42
1

The answer was already provided by Hans Passant in https://stackoverflow.com/a/2302109/292411

For two identifiers to be considered distinct, they must differ by more than just their case.

So it seems, unfortunately, you cannot consume this library in its current form without running into that issue.

Community
  • 1
  • 1
C.Evenhuis
  • 25,996
  • 2
  • 58
  • 72
  • Thanks! For all those struggling: (maybe i am the only one) I downloaded the source, changed the class name and c# did the renaming itself, built it and used it :-) – Shreyas Kapur May 23 '12 at 07:41