Saturday, February 23, 2019

[C++ Builder] FLOAT_INVALID_OVERFLOW!! SetExceptionMask !!

Error FLOAT_INVALID_OVERFLOW occurred when calling a function from a DLL build by VC from C++ Builder? This is a problem of C++ Build and solve if by calling SetExceptionMask before calling your Dll.

Example:


#include <System.Math.hpp>

typedef int (*PFNAddFunction)(int, int);

void testDllCall()
{
  //Mask Exception
  TFPUExceptionMask fExceptionMask ;
  fExceptionMask=GetExceptionMask();
  fExceptionMask << exInvalidOp;
  fExceptionMask <<  exDenormalized;
  fExceptionMask <<  exZeroDivide;
  fExceptionMask << exOverflow;
  fExceptionMask << exUnderflow;
  fExceptionMask << exPrecision;
  SetExceptionMask(fExceptionMask);
  //Call DLL
  HMODULE _dll=LoadLibraryA("dllName.dll");
  if(_dll != NULL) {
    PFNAddFunction myAdd = (PFNAddFunction)GetProcAddress(_dll,"funcAdd");
    myAdd(1,2)
    FreeLibrary(_dll);
  }
}
[Reference]
https://delphi.fandom.com/wiki/SetExceptionMask_Routine
http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.Math.SetExceptionMask

Friday, December 28, 2018

http-push failed for private Git server on XAMPP

Using local folder path as URL

eg., use D:\GitRepos\project instead of http://127.0.0.1/git/project

the same for pull data from Server

Thursday, September 6, 2018

Run .exe from PHP



PHP範例

<?php

$answer = shell_exec("exe\AplusB.exe 1.3 2.5");  //路徑要用 反斜線 啊 windows

echo $answer."</br>";

?>



C++ 範例 (AplusB.exe):二個數值相加

#include <stdlib.h>
int main(int argc,  char* argv[]) { if (argc <= 1) return -1; double a = atof(argv[1]); double b = atof(argv[2]); printf("%lf + %lf = %lf\n", a, b, a + b); return 0; }

PHP執行結果:

1.300000 + 2.500000 = 3.800000


[Reference]
https://stackoverflow.com/questions/12251634/how-to-run-abc-exe-using-php
http://eeepage.info/php-system-exec-passthru/

[Qt] 執行檔需要哪些 Dll?

 1. 使用 Qt  的 windeployqt.exe 工具 (在 C:\Qt\Qt5.14.1\5.14.1\msvc2017\bin\)。   a. 把執行檔 myProgram.exe 放在某個資料夾。   b. 在檔案總管這個資料夾按 Shift 和滑鼠右鍵,開啟 Po...