ladislav-zezula / StormLib

Official GitHub repository of the StormLib library created by Ladislav Zezula (author)
http://www.zezula.net/mpq.html
MIT License
561 stars 214 forks source link

GetLastError() conflict a bug or not? #27

Closed cen1 closed 10 years ago

cen1 commented 10 years ago

Basically reopening issue from https://github.com/ladislav-zezula/StormLib/issues/11

On windows there is no conflict because Stormlib uses direct call to WINAPI function but on Linux/BSD this is defined as a wrapper function to get errno (and the call comes from stormlib itself). If you have another class or library doing the same wrapping you get into a conflict described in the issue above.

The solution is to simply introduce StormGetLastError() which calls GetLastError() on windows and errno on linux/bsd.

Two questions coming to mind:

  1. Is this an actual bug or should we simply fix things in other projects?
  2. Is it worth breaking the "API" to fix this?

I guess I am seeking for an opinion rather than asking for a fix or doing a pull request.

Profforgr commented 10 years ago

I guess I am seeking for an opinion rather than asking for a fix or doing a pull request.

I guess, anyone can fix this issue inside it's own project. No need to change this on StormLib side.

ladislav-zezula commented 10 years ago

Changing it now would only break all programs compiled with StormLib. And as Stormlib is gonna be deprecated in some time (MPQ --> CASC), then it's not worth the effort.