Declare Currency Type to Be Double When Returning from DLL

Last reviewed: June 21, 1995
Article ID: Q72274
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SUMMARY

When using Microsoft Visual Basic for Windows, if you want to pass a parameter to a dynamic link library (DLL) routine, or receive a function return value of type Currency from a DLL routine written in Microsoft C, the parameter or function returned should be declared as a "double" in the C routine.

NOTE: C does not support the Basic Currency data type, and although specifying the parameter as type "double" in C will allow it to be passed correctly, you will have to write your own C routines to manipulate the data in the Currency variable. For information on the internal format of the Currency data type, query in the Microsoft Knowledge Base using the following words:

Basic and Currency and internal and format

MORE INFORMATION

When creating a DLL function that either receives or returns a Currency data type, it may be useful to include the following declaration:

   typedef double currency;

Based on this typedef, a sample DLL routine to return a currency value might be declared as follows:

   currency FAR pascal test(...);


Additional reference words: 1.00 2.00 3.00
KBCategory: kbprg
KBSubcategory: APrgOther


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.