Microsoft KB Archive/191327

From BetaArchive Wiki

Article ID: 191327

Article Last Modified on 5/12/2003



APPLIES TO

  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 5.0a



This article was previously published under Q191327

SYMPTOMS

If you create a .dll file that contains an exported function, which returns a value of type Double, when you declare and call this function from Visual FoxPro, any decimal portion of the return value is set to 0.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in Visual FoxPro 6.0.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Microsoft Visual C++, create test2.cpp which will contain the following code:

          //test2.cpp
          #include <windows.h>
    
          BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_to_call, LPVOID
       lpReserved)
          {
              return TRUE;
                  UNREFERENCED_PARAMETER(hInst);
                  UNREFERENCED_PARAMETER(ul_reason_to_call);
                  UNREFERENCED_PARAMETER(lpReserved);
          };
    
          double APIENTRY test(double p1, double p2)
          {
           return p1 * p2;
          };
                            
  2. Create a file called Test2.DEF with the following contents:

          ; test2.def : Declares the module parameters for the DLL.
    
          LIBRARY      "Test2"
          DESCRIPTION  'Test2 Dynamic Link Library'
    
          EXPORTS
             test @4
  3. Build Test2.dll as a Multithreaded .dll file.
  4. In Visual FoxPro, set the directory containing the .dll built in Step 4 as the default directory.
  5. Run the following from the Command window:

          DECLARE DOUBLE test IN test2.dll DOUBLE, DOUBLE
          ? test(1.5, 1.5)
          ? test(2.5, 2.5)
                            

    You will get return values of:

    2.00
    6.00

Any decimal portion of the double value returned from the .dll function will be 0.

REFERENCES


Additional query words: kbVFp500abug kbVFp300bbug kbVFp600fix kbInterOp kbfvp600fix

Keywords: kbbug kbfix kbcode KB191327