delphi报了一个错误: floating point division by zero

sinovoice 2007-01-18 06:00:52
写了一个dll文件,调用c写的动态库,然后书写一个c写的测试程序。ok.但是如过我使用delphi的话。就会报:floating point division by zero。那位遇到过,指点一二。谢谢啊
...全文
3400 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
jeese888 2012-10-23
  • 打赏
  • 举报
回复 1
在你的delphi主程序中,加入下面这条语句:
Set8087CW(Default8087CW or $3F);

用于屏蔽CPU的浮点数被零除异常信息的。

baiduan 2007-06-04
  • 打赏
  • 举报
回复
不太明白,
在一般的c编译器中:
c 的 int类型 为16位整数
应该和
delphi的Smallint 相当.

c的long类型 =D的longint类型.


是不是这里有问题?
ahjoe 2007-06-04
  • 打赏
  • 举报
回复
也就是参数入栈顺序,以及堆栈由谁释放的问题
sinovoice 2007-06-01
  • 打赏
  • 举报
回复
回复楼上的。因为TAOecInit接口是用c写的。他涉及到很多.h,.c文件.所以我们是现封装成dll。在由delphi来调用。
dd_zhouqian 2007-04-30
  • 打赏
  • 举报
回复
在delphi里为什么不直接调用TAOecInit?
sinovoice 2007-04-28
  • 打赏
  • 举报
回复
该问题一直没有解决。后因项目销售催得紧。靠其他办法解决了。不过楼上的说得还靠点谱。
skertone 2007-02-05
  • 打赏
  • 举报
回复
TAOecInit(NULL); 是什么类型的接口?

Uses ComObj;一下

或手工
COM库:CoInitialize{Ex}、CoUnitialize
OLE系统:OleInitialize、OleUnitialize
sinovoice 2007-01-29
  • 打赏
  • 举报
回复
那位能帮帮解决一下啊
dovelee 2007-01-19
  • 打赏
  • 举报
回复
如果方便的话,把代码贴出来瞧瞧
keyz 2007-01-19
  • 打赏
  • 举报
回复
用了stdcall没有?
madyak 2007-01-19
  • 打赏
  • 举报
回复
我不明白你为什么不把代码弄上来
sinovoice 2007-01-19
  • 打赏
  • 举报
回复
我跟踪了下,就是到fstp指令集处。网上也搜了下。,有位高手说是类型转换问题,也没有下文了。郁闷!debug就试到进入dll函数接口时报错误了。查delphi帮助说是语言异常。
sinovoice 2007-01-19
  • 打赏
  • 举报
回复
在vc的windef.h文件中是这么定义WINAPI的#define WINAPI __stdcall,所以madyak您说的好像还不对
madyak 2007-01-19
  • 打赏
  • 举报
回复
C默认的调用方式好象是cdecl,在DELPHI你声明的stdcall
可能是这个的问题。把它们声明成一致的。
sinovoice 2007-01-19
  • 打赏
  • 举报
回复
testdll写错了,应该是testopt.dll
sinovoice 2007-01-19
  • 打赏
  • 举报
回复
#ifndef __TESTOPT_H__
#define __TESTOPT_H__

#ifdef __cplusplus
extern "C" {
#endif
int WINAPI EpoptInit();

#ifdef __cplusplus
}
#endif

#endif
--------------

#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"

#include "testopt.h"
#include "windows.h"
#include "process.h"

/************************************************************************/
/* 初始化函数 0 成功,-1失败 */
/************************************************************************/
int WINAPI EpoptInit()
{
int recResult = TAOecInit(NULL); //TAOecInit是另外厂商提供的,无法在跟踪了
if (recResult!=0)
{
g_bInit=false;
MakeErrCodeForRec("TAOecInit",ecResult);
return -1;
}
WriteLogFile("初始化ec成功!");
return 0;
}

------------------
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

{
function EpoptInit() : longint;stdcall;external 'testdll.dll';

}

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;

function EpoptInit() : Longint;stdcall;external 'testdll.dll';

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
ThreadId : DWord;
iResult : Integer;
i : Integer;
arrayHandle : array[0..11] of THandle;
begin
iResult := EpoptInit();//此处出错了,
if iResult <> 0 then
begin
exit;
end;

end;
sinovoice 2007-01-19
  • 打赏
  • 举报
回复
DLL的声明,我使用WINAPI的,并且我的delphi程序也没有向代码内部传参数,只是调用funInit()就报错误了.使用c/c++写的就没有
madyak 2007-01-18
  • 打赏
  • 举报
回复
应该是在DELPHI中参数或者指示字没有声明对
sinovoice 2007-01-18
  • 打赏
  • 举报
回复
程序一开施就报这个错误,而且我也没有用到除法运算
sinovoice 2007-01-18
  • 打赏
  • 举报
回复
该dll 文件是用c写的。但是我使用delphi调用它就报错。用c写的就可以通过
加载更多回复(1)
********************************************************************** Author: TMS Software Copyright ?1996-2014 E-mail: info@tmssoftware.com Web: http://www.tmssoftware.com ********************************************************************** TMS Pack for FireMonkey TMS Pack for FireMonkey contains components for use in user interfaces designed with the Embarcadero FireMonkey framework. The components have been designed from the ground up based on the core concepts of the FireMonkey framework: made up of styles, fully cross-platform, scalable and compatible with FireMonkey抯 effects, rotation, livebindings. Release 2.3.0.1: ----------------- Highly styleable cross-platform FireMonkey controls Support for Windows 32 bit, 64 bit, Mac OS X, iOS and Android Support for HTML formatted text, including hyperlinks in various parts of the components Built-in support for LiveBindings in TTMSFMXTableView and TTMSFMXTileList, allows to bind any item element to data Includes various demos and an extensive PDF developers guide Includes various helper controls (badge, button and html enabled text controls) that can be used separately as well Includes several Sample applications for the TTMSFMXGrid component History : --------- v1.0 : first release v1.0.0.1 Fixed : Issue with setting the focus on the form (Can be activated / deactivated with ShowActivated property) in TTMSFMXPopup Fixed : Issue with BitmapContainer assignment V1.1.0.0 New : Introducing TTMSFMXSpeedButton New : Introducing TTMSFMXHotSpotImage with separate editor Improved : TMSIOS Define Fixed : Issue with initial state when State is ssOn in TTMSFMXSlider Fixed : Issue with Opacity in HTML Drawing in TTMSFMXHTMLText v1.1.0.1 Fixed : Issue with parent in TTMSFMXPopup v1.1.0.2 Fixed : Issue with lfm file missing in package v1.1.0.3 New : Support for update 4 hotfix 1 Fixed : Issue with order of freeing objects in TTMSFMXTableView v1.1.0.4 Fixed : Issue with state changing with mouse out of bounds in TTMSFMXSlider Fixed : Issue with resizing detail view in TTMSFMXTableView v1.5.0.0 New : Components TTMSFMXGrid, TTMSFMXNavBar, TTMSFMXEdit and TTMSFMXEditBtn, TTMSFMXProgressBar New : Helper components: TTMSFMXGridPrintPreview, TTMSFMXFindDialog, TTMSFMXReplaceDialog, TTMSFMXExcelIO, TTMSFMXRTFIO. Improved : Performance for handling hover & click of hotspots in TTMSFMXHotSpotImage Fixed : Issue with mouse capturing in TTMSFMXTableView Fixed : Issue with alignment and resizing of detail view container when item has no detail view assigned in TTMSFMXTableview v1.6.0.0 New : XE3 Support New : OnSearchOpen / OnSearchClose called when swiping done or showing the filter with the ShowFilter property in TMSFMXTableView New : OnCanColumnDrag, OnCanRowDrag events added in TTMSFMXGrid New : OnColumnDragged, OnRowDragged events added in TTMSFMXGrid New : LiveBindings support in TTMSFMXGrid Fixed : Issue with Options.Mouse.ColumnDragging = false / Options.Mouse.RowDragging = false in TTMSFMXGrid Fixed : Issue with OnCanInsertRow/OnCanDeleteRow triggering in TTMSFMXGrid Fixed : Issue with selection on top when dragging in touch mode in TTMSFMXGrid Fixed : Access violation when touching outside the grid in touch mode in TTMSFMXGrid Fixed : Enabling touch mode in none selection mode in TTMSFMXGrid Fixed : Issue with OnClick / OnDblClick in instrumentation components Fixed : Issue with scrolling and selecting value in iOS in TTMSFMXSpinner Fixed : Issue with escape key not cancelling edit mode in TTMSFMXGrid v1.6.0.1 Fixed : Issue with double databinding registration in XE2 ios package v1.7.0.0 : New : added components TTMSFMXCalendar and TTMSFMXCalendarPicker New : Fixed cell single and range selection in TTMSFMXGrid New : Autosizing columns / rows on double-click in TTMSFMXGrid New : Column persistence in TTMSFMXGrid Improved : Data reset when toggling active in TTMSFMXScope Fixed : Issue with checkbox and radiobutton not rendering correctly on iOS project in TTMSFMXGrid Fixed : Issue with accessing and adding progressbar cells in TTMSFMXGrid Fixed : Repaint bug in XE3 in TTMSFMXTileList Fixed : ShowGroupGount implement in TTMSFMXGrid Fixed : GroupCountFormat implemented in TTMSFMXGrid Fixed : Issue with memoryleak in TTMSFMXLedBar Fixed : Access violation when clicking edit button in TTMSFMXTableView Fixed : Issue with OnDblClick not triggered in TTMSFMXTableView Fixed : Issue with popupmenu on background interfering with scrolling interaction in TTMSFMXTableView Fixed : Issue with selection persistence of items when scrolling in TTMSFMXTableView Fixed : Access violation Loading footer at designtime in TTMSFMXPanel v1.7.5.0 New: Capability to export multiple grids to a single RTF file in TTMSFMXGridRtfIO New : Options.Filtering.MultiColumn added to perform automatic multicolumn filtering in TTMSFMXGrid Fixed : Issue with Delphi XE3 compatibility in TTMSFMXCalendar Fixed : Issue with ApplyPlacement for plTop/plTopCenter in TTMSFMXPopup Fixed : Issue with sorting & filtering in TTMSFMXGrid Fixed : Issue with InsertRow on non-initialized grid in TTMSFMXGrid Fixed : Issue with XE3 Mac filtering in TTMSFMXGrid v1.7.5.1 Fixed : Issue with anchor detection when scrolling in TTMSFMXGrid Fixed : Issue with ccCount column calc in TTMSFMXGrid v1.7.5.2 New : Exposed functions CancelEdit / StopEdit in TTMSFMXGrid Fixed : Issue with text initialization in constructor in TTMSFMXGrid Fixed : Issue with default values for ArrowHeight and ArrowWidth in TTMSFMXPopup Fixed : Issue with focusing calendar in TTMSFMXCalendar Fixed : Issue with lookuplist in TTMSFMXEdit in XE3 Fixed : Issue with absoluteopacity in TTMSFMXLED v1.8.0.0 New : PDF Export component for Windows (QuickPDF), Mac and iOS v1.8.0.1 Fixed : Issue with absolute opacity in TTMSFMXBitmap Fixed : Issue with editing cell functionality while selecting all cells in TTMSFMXGrid v1.8.0.2 Fixed : Issue with peristing column states Fixed : Issue with printing DPI on different real and virtual printers v1.8.0.3 Fixed : Issue with dblclick in TTMSFMXGrid Fixed : Issue with dropdown window visible after editing in TTMSFMXGrid Fixed : Issue with wordwrapping and strikeout font style in html engine v1.8.0.4 : Fixed : Issue with debug message in TTMSFMXGrid v1.8.0.5 Fixed : Issue with dblclick focusing issue in TTMSFMXGrid Improved : comment popup in cell configurable in TTMSFMXGridCell v1.8.0.6 Improved : PDF Export engine v1.8.0.7 Package build options change v1.8.0.8 Fixed : Issue with text repainting at runtime in TTMSFMXHTMLText Fixed : Issue with text fill color initialization in TTMSFMXHTMLText Fixed : Repaint bug in XE3 in drag/drop tiles in TTMSFMXTileList Fixed : Issue with memoryleak when reparenting items in TTMSFMXTableView Fixed : Issue with hidden radio button checked property in TTMSFMXGrid v1.8.1.0 Fixed : Issue with clipboard on empty grid in TTMSFMXGrid New : Event OnTopLeftChanged event v1.8.1.1 Improved : block refreshing columns when destroying the component in TTMSFMXSpinner Fixed : Small issue in HTML Rendering engine for anchor rendering in TTMSFMXHTMLEngine Fixed : Issue with hidecolumn in TTMSFMXGrid v1.8.1.2 Issue with C++Builder OSX library paths not updated when installing v1.8.1.3 Issue compilation in FPC with TMSPlatforms constant v1.8.1.4 Improved : Added Event OnCellEditCancel in TTMSFMXGrid Improved : OnTileAnchorClick event exposed in TTMSFMXTileList Improved : Escape key handling in TTMSFMXCalendarPicker to cancel date selection Fixed : Issue with TMSFMXEdit signed float Fixed : Issue with dblclick in TTMSFMXEdit Fixed : Issue with dropdown access violation in TTMSFMXEdit Fixed : Access violation in TTMSFMXPopup v2.0.0.0 New : Syntax highlighting and editing component TTMSFMXMemo New : Persisted Columns collection in TTMSFMXGrid New : KeyBoard and Mouse Wheel handling support in TTMSFMXSpinner Improved : Escape to cancel date selection and return to previous selected date in TTMSFMXCalendar Fixed: Issue with autosizing and client-aligned captions v2.0.1.0 New : Pointer direction property in TTMSFMXBarButton Fixed : Issue with repainting header and footer text in TTMSFMXTableView Fixed : Selection changed notification to observer in TTMSFMXTableView Fixed : Issue with list read access in TTMSFMXNavBar Fixed : incorrect Gutter behavior when gutter is visible false or width = 0 in TTMSFMXMemo Fixed : Issue with XE2 FMI package memo registration v2.0.1.1 Fixed : Issue with height of tabs in TTMSFMXNavBar v2.0.2.0 New : OnButtonClick event in TTMSFMXEditBtn Fixed : Issue with fixed cell property persistence in TTMSFMXGrid Fixed : Issue with Excel font color import in TTMSFMXGrid Fixed : Issue with border width in new columns persistence collection in TTMSFMXGrid Fixed : Issue with bitmap assignment in TTMSFMXTableView Fixed : Issue with clearing cells in TTMSFMXGrid v2.0.2.1 Fixed : Issue with anchors & readonly cells in TTMSFMXGrid Fixed : Issue with handling Columns[x].ReadOnly Improved : Published events for Find and Replaced dialog in TTMSFMXMemo v2.1.0.0 New : XE4 support Fixed : Issue with memory leak in TTMSFMXGrid Fixed : Issue with triggering OnCursorChange in TTMSFMXMemo Fixed : Issue with UpdateMemo call when client-aligning Fixed : Issue with index out of bounds in empty grid connected to dataset v2.1.0.1 Improved : NextPage and PreviousPage methods in TTMSFMXGrid Fixed : Issue compiling demo's in trial version Fixed : Issue with LoadFromFile column widths in TTMSFMXGrid v2.1.0.2 Improved : GetTextHeight function in TTMSFMXHTMLText Fixed : Issue with iOS cell objects not being freed in TTMSFMXGrid Fixed : Issue with Scrolling when scrollbars are not visible in TTMSFMXGrid Fixed : Issue with readonly cells when using columns in TTMSFMXGrid Fixed : Issue accessing correct cell colors in TTMSFMXGrid Fixed : Issue with displaying DetailView in TTMSFMXTableView v2.1.0.3 Improved : Added Fixed Disjunct Row and Column Selection in TTMSFMXGrid Fixed : Issue with LiveBindings editing and row selection in TTMSFMXGrid Fixed : Replacement for TScrollBox issues at designtime / runtime. Fixed : Issue with Form Key handling in TTMSFMXEdit Fixed : Issue with designtime initialization of caption in TTMSFMXPanel Fixed : Issue with autocompletion popup in TTMSFMXMemo Fixed : Issue with font persistence in TTMSFMXMemo Fixed : Issue with ShowImage in TTMSFMXBarButton Fixed : Issue on iOS with categories in TTMSFMXTableView v2.1.0.4 Fixed : Issue with grid editing / inserting in LiveBindings in TTMSFMXGrid v2.1.0.5 Fixed : Memory leak with panel list in TTMSFMXNavBar Fixed : Access violation in TTMSFMXMemo v2.1.1.0 New : VisibleRowCount and VisibleColumnCount functionality in TTMSFMXGrid Fixed : Issue with disjunct selection and sorting in TTMSFMXGrid v2.1.1.2 New : LiveBinding support for Notes in TTMSFMXTileList v2.1.1.3 New : Published Anchors property Fixed : Issue inserting and deleting records in LiveBindings in TTMSFMXGrid v2.1.1.4 Fixed : Issue with RadioButtons in TTMSFMXGrid Fixed : Issue with Text position and width in TTMSFMXRotarySwitch v2.1.1.5 Fixed : Issue with rtf exporting on iOS in TTMSFMXGrid Fixed : Issue with ColumnStatesToString and column swapping in TTMSFMXGrid Fixed : Issue with lookup list on Mac in TTMSFMXEdit v2.1.1.6 Fixed : Issue with assign procedure collection item in TTMSFMXTableView Fixed : Issue with TTMSFMXPopup component on the form already exists v2.1.1.7 Improved: Assign() handling in TTMSFMXTableView Improved : conditionally use XOpenURL or XOpenFile for cell anchors in TTMSFMXGrid Fixed : Issue with Padding vs Margins in TTMSFMXPageSlider Fixed : Issue with comment resizing in TTMSFMXGrid Fixed : Issue with TableView resizing in TTMSFMXTableView Fixed : issue with column alignment settings for cell states different from normal in TTMSFMXGrid Fixed: Do not set TopMost = true in GetStyleObject, interferes with use on a popup in TTMSFMXEdit Fixed : Issue with initialization years in popup picker in TTMSFMXCalendarPicker Fixed : issue with setting Collaps = true at design time in TTMSFMXPanel Fixed : Issue with pressing ESC when date is empty in TTMSFMXCalendarPicker v2.2.0.0 New : XE5 support New : Android support New : Width and Height properties on lookup list in TTMSFMXEdit New : Redesign of TTMSFMXPopup to support iOS / Android Fixed : Issue with lookup autosize calculation in TTMSFMXEdit Fixed : Hints in TTMSFMXHTMLText and TTMSFMXBitmap Fixed : Issue with OnColumnSorted event not triggered in TTMSFMXGrid v2.2.0.1 Fixed : Issue with deleting rows in TTMSFMXGrid Fixed : Issue with date parsing in TTMSFMXCalendar Fixed : CSV parsing on iOS / Android in TTMSFMXGrid v2.2.1.0 New : OnMonthChanged and OnYearChanged events in TTMSFMXCalendar Fixed : Issue with money editing in TTMSFMXGrid v2.2.1.1 Fixed : Issue with disposing objects on iOS in TTMSFMXGrid Fixed : Issue with items return with incorrect CategoryID in TTMSFMXTableView v2.2.1.2 Fixed : Issue with column moving & column sizes in TTMSFMXGrid Fixed : Issue with save to file & linebreaks on iOS / Android in TTMSFMXGrid Fixed : Issue with column, row dragging out of the grid boundaries in TTMSFMXGrid Fixed : Issue with resizing in TTMSFMXTableView v2.2.1.3 Fixed : Issue with scrollbox and applystyle empty text initialization in TTMSFMXEdit Fixed : Issue with string conversion on iOS / Android in TTMSFMXGrid Fixed : Issue with column, row dragging out of the grid boundaries in TTMSFMXGrid Fixed : Issue with Livebindings in TTMSFMXCalendarPicker v2.2.1.4 Fixed : Issue with badge in TTMSFMXTileList Fixed : Issue with row sorting and objects in TTMSFMXGrid v2.2.2.0 Improved : Disjunct deselection of column, rows and cells in TTMSFMXGrid Fixed : Issue with horizontal scrolling and text trimming in TTMSFMXMemo Fixed : Issue with displaylist on XE5 in TTMSFMXEdit Fixed : Issue with assignment of item an OnItemClick in TTMSFMXTableView Fixed : Floating point division by zero in TTMSFMXPopup Fixed : Issue with OnCellEditDone event and focus changes v2.2.2.1 Fixed: Issue with Keyboard handling for ComboBox editor type in TTMSFMXGrid v2.2.2.2 Fixed : Issue with saving hotspot images in TTMSFMXHotSpotImage Fixed : Issue with memo find & replace dialog up and down search in TTMSFMXMemo Fixed : Issue with naming for led elements in TTMSFMX7SegLed Fixed : Issue with mouse enter/leave in TTMSFMXCalendar Fixed : Issue with column hiding and memory leak in sorting data in TTMSFMXGrid v2.2.2.3 Fixed : Issue with column/row hiding combinations in TTMSFMXGrid Fixed : Issue with Escape key in TTMSFMXGrid v2.2.2.4 Fixed : Issues with column/row handling in TTMSFMXGrid Fixed : Issue with calculation setpoints, needles and sections with minimumvalue > 0 in TTMSFMXLinearGauge v2.2.2.5 Improved: Signed numeric not being handled in GetInt/SetInt in TTMSFMXEdit Fixed: Issue with unhiding row combinations in TTMSFMXGrid v2.2.2.6 Improved : OnFormatCellDataExpression in TTMSFMXGrid Fixed : Issue with selection initialization in TTMSFMXGrid Fixed : Issue with cell creation in xls export v2.2.2.7 Fixed : Issue with using semi opaque hover, selected, down color in TTMSHotSpotImage Fixed : Issue with row insertion in TTMSFMXGrid v2.2.2.8 Fixed : Issue with grouping / ungrouping and row / column insertion changes v2.2.2.9 Improved : Clearing grid offset in TTMSFMXScope Fixed : Issue with initializing grid with default no. columns in TTMSFMXGrid Fixed : Issue with adding data without animation in TTMSFMXScope v2.3.0.0 New : XE6 Support v2.3.0.1 Fixed : XE6 Style compatibility issues Usage: ------ Use of TMS software components in applications requires a license. A license can be obtained by registration. A single developer license registration is available as well as a site license. With the purchase of one single developer license, one developer in the company is entitled to: - use of registered version that contains full source code and no limitations - free updates for a full version cycle - free email priority support & access to support newsgroups - discounts to purchases of other products With a site license, multiple developers in the company are entitled to: - use of registered version that contains full source code and no limitations - add additional developers at any time who make use of the components - free updates for a full version cycle - free email priority support & access to support newsgroups - discounts to purchases of other products Online order information can be found at: http://www.tmssoftware.com/go/?orders Note: ----- The components are also part of the TMS Component Pack bundle, see http://www.tmssoftware.com/go/?tmspack Help, hints, tips, bug reports: ------------------------------- Send any questions/remarks/suggestions to : help@tmssoftware.com Before contacting support about a possible issue with the component you encounter, make sure that you are using the latest version of the component. If a problem persists with the latest version, provide information about which Delphi or C++Builder version you are using as well as the operating system and if possible, steps to reproduce the problem you encounter. That will guarantee the fastest turnaround times for your support case.

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧