Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
3 ratings:
 5 out of 5   

Floating Point Exception When Calling Borland C++Builder or Delphi DLL or Executable



Primary Software:
Primary Software Version: N/A
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I get a Floating Point Exception when code I wrote in Borland C++Builder or Delphi calls Measurement Studio functions.

Solution:
It is hard for National Instruments to meet the standards of every compiler. Most compilers suppress floating point exceptions. Borland C++Builder and Delphi do not suppress them. It is easy to turn this option off in both C++Builder and Delphi.

The following code turns them off in C++Builder:

#include float.h

__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
_control87(MCW_EM, MCW_EM);
}

The following code turns them off in Delphi:

const MCW_EM = DWord($133f);
begin
Set8087CW(MCW_EM);
end;


You can set these right before you call into Measurement Studio functions and then undo them afterward.

Related Links:
Turning off Floating Point Exceptions in BCB and Delphi


Attachments:





Report Date: 12/20/2005
Last Updated: 11/12/2008
Document ID: 3SJA58DR

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit