Home > Back-end >  Urgent for help: Delphi do not agree with MFC algorithm results.
Urgent for help: Delphi do not agree with MFC algorithm results.

Time:10-27

Use MFC DLL encapsulates a mathematical algorithm, in order to prove the validity of the algorithm, the DLL provides an interface, the interface does not require any input variables, such as DLLTest (),
Use MFC program calls, the computed result is correct, but with Delphi call, the result of calculation is not correct,
The algorithm involves the large matrix and singular value decomposition,
Of all input data and computing the DLL are own implementation, why dephi calls the result is not correct?

CodePudding user response:

That depends on how to deal with in the DLL, the key lies in the data type

CodePudding user response:

MFC and Delphi calls to the Dll code posted a look,

CodePudding user response:

Your calling method is wrong

CodePudding user response:

Calculate the result is what kind?

CodePudding user response:

stdcall

CodePudding user response:

Delphi calls:
USES the
The function DllTest () : a Boolean; Stdcall; External 'Invert. DLL';

Procedure TForm1. Btn3Click (Sender: TObject);
The begin
DllTest ();
end;

Win32 Console Application calls:

Extern "C" bool _stdcall DllTest (void);
# pragma comment (lib, "Invert. Lib")

Int _tmain (int arg c, _TCHAR * argv [])
{
DllTest ();
return 0;
}

CodePudding user response:

DLL itself from a TXT read data to calculate, and writes the results another TXT, the whole process is independent of external call, do not understand,

CodePudding user response:

I ever encounter such a situation, the problem for the DLL call, using vc + + calling it is normal, with Delphi call is not normal, is also similar to the building Lord, I later asked to provide a DLL to our company, they said that the DLL in vc + + compiler, and incompatible with Delphi call may exist, then check a lot of information, has not related, but at the same time we ever written in vc + + DLL, using Delphi call line not line, ultimately, all change to vc + + development, estimate you are this kind of situation, perhaps when vc + + in the generated DLL is also note what compatibility Settings?

CodePudding user response:

Call data type, length, check the mapping of the Delphi and C, especially involving the Delphi variable values, such as Word length will go wrong, Russia met before:)

CodePudding user response:

In c + + Builder test again today, the calculation results is no problem, is the Delphi call the result is not correct, depressed!

CodePudding user response:

C + + Builder, because is
c + + language
Delphi using Pascal language, should agree with what results

CodePudding user response:

Might be wrong, a header file call order,

CodePudding user response:

Almost 100% of their differences in data types, stick your DllTest MFC implementation code () to look at

CodePudding user response:

Estimates is the issue of CPU floating-point logo
  • Related