Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Error handling in .Net  (Read 5803 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Error handling in .Net
« Reply #15 on: July 02, 2013, 08:03:20 am »
Quote
Are the 32bit windows csfml dlls MinGW compiled?
No, I always use Visual C++.
Laurent Gomila - SFML developer

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: Error handling in .Net
« Reply #16 on: July 02, 2013, 02:45:08 pm »
Hmm ok. No idea then. I don't know the lowlevel win32/compiler stuff that could be causing this weird behavior.  My best idea now is to:

1. Make sfml redirect sf:err hardcoded in source:
std::ofstream file("Path\\ToSome\\File.txt");
std::streambuf* previous = sf::err().rdbuf(file.rdbuf());

2. Setup sfml build environment and build

3. Setup csfml build environment and build

Any other suggestions? I really don't wanna move away from sfml :/

Merci!
myl
« Last Edit: July 02, 2013, 02:49:55 pm by myl »

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: Error handling in .Net
« Reply #17 on: July 04, 2013, 12:43:37 am »
Even though I have little knowledge of visual c++, I guess the issue could be caused by this:
http://www.syndicateofideas.com/posts/fighting-the-msvcrt-dll-hell

Not sure if knowing this brings me any closer to a solution :/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Error handling in .Net
« Reply #18 on: July 04, 2013, 08:12:27 am »
It's quite long. Can you summarize what it says? ;D
Laurent Gomila - SFML developer

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Error handling in .Net
« Reply #19 on: July 06, 2013, 05:48:36 am »
It's quite long. Can you summarize what it says? ;D

I will do my best to summarize it.

Whenever you compile any C\C++ program with VS it is bound to MSCRTxxx.DLL. The xxx is a number that relates to version of VS that you used (VS 2003, VS 2005, VS 2008, ect...). So if you attempt to get output from a DLL that was compiled in a different version of VS the output is not directed correctly.

Here is a quote that sums up the safe solution.

Quote
The only safe solution is to use the same CRT for your application and your application’s modules. This has some drawbacks of course, and the major one is that you simply must ensure that all dependencies are using the same compiler generation and thus linking to the same CRT DLL. Within Apache Httpd we were using good old Visual Studio 6.0 for producing official binaries, but recently there were some discussion to switch to Visual Studio 2010.


Myl, what I would suggest is that you try to recompile CSFML with whatever version of VS you are using.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Error handling in .Net
« Reply #20 on: July 06, 2013, 06:37:48 am »
Quote
Myl, what I would suggest is that you try to recompile CSFML with whatever version of VS you are using.
You should do it :P
I'm not going to provide 3 different builds of CSFML when I can only have one that works with all the Windows compilers.

I agree that this problem is annoying, but as I said, I'd rather find a more convenient way to handle errors.
Laurent Gomila - SFML developer