Handling Charset Details

Coordinator
Feb 1, 2009 at 7:39 AM
Most of the Win32 API's support both Ansi and Unicode (wide char) version (eg: Ansi version of MessageBox is MessageBoxA and unicode version is MessageBoxW). I would like to get your inputs on what is the best way to support both of them in the wrapper. I can think of following two ways

  • Define both functions with A/W suffice in the same class. For example, User32.MessageBoxA will be ansi version and User32.MessageBoxW will be unicode version
  • Segregate Charset differences into different namespace. For example ansi version of MessageBox will live in User32.Ansi namespce and unicode version will live in User32.Unicode namesspace and both the functions will have same name MessageBox

Please let me know your thoughts on this and if there are any other elegant ways to achieving this.