3

I'm doing a program to set the precision control of the FPU to 24 bits and the rounding mode to "near" using the _controlfp_s function. I want to create a dll for Windows and a bundle for OS X.

I can't find _controlfp_s when compiling with Xcode, I think it's part of a Microsoft library unavailable on Mac.

I'd like to use the same .c file on both projects, so is there a way to compile this to OS X? Is there a C Microsoft compiler for Mac?

Thank you.

osgx
  • 90,338
  • 53
  • 357
  • 513
Roberto
  • 11,557
  • 16
  • 54
  • 68
  • 1
    Duplicate: http://stackoverflow.com/questions/2900614/how-to-set-double-precision-in-c-on-macosx – payne Mar 18 '11 at 17:55
  • no, it's not. He doesn't say what can be used to compile C in Mac with Microsoft libraries. I'd rather not use FLDCW, I have code running with _controlfp_s that I wouldn't like to rewrite and test on different computers again, I'm sorry I didn't mention it before. – Roberto Mar 18 '11 at 18:37
  • 1
    What do you mean compile C in Mac with Microsoft libraries? That doesn't make sense. You don't get MSVCRT on Mac. Parts of your code are not portable. Control words are inherently non-portable. You are simply going to have to such it down and port _controlfp_s to Mac. – David Heffernan Mar 18 '11 at 19:35
  • The other question pointed by payne there is an answer saying "use a Microsoft compiler for Mac" so I naively thought there was a way to compile MS libraries. So OK, thank you, I'll port it. – Roberto Mar 24 '11 at 15:28

1 Answers1

1

There is no way to do this. I had to port _controlfp_s to Mac.

Roberto
  • 11,557
  • 16
  • 54
  • 68