DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2006


    Q1: "atof" is locale-dependent function, in "atof_l" locale could be managed but it needs "xlocale.h" file. What platform do i need in order to have "xlocale.h"?

    Q2: In MSDN there is "_atof_l" function, but there are only 2 results in google about it. In MSDN it is said that it needs "stdlib.h" and "math.h", but there is no declaration of that function in these files. Does any one knows what it takes to compile the code with "_atof_l" within it?

    Q3: What is the general method to create locale-independent software? Writing setlocale("English") in the main scope? Use of pragmas?

    Q3.1: In our project we have lots of DLL-s which are unaffected by the "main" setlocale function call. Does any know a better way to change the loaded DLL-s locale, without changing every DLL code?

    Please assist. Thanks.

  2. #2
    Join Date
    Nov 2003
    OK, it's a bit tricky indeed: all the locale-dependent functions you mentioned aren't standard. They are Microsoft proprietary extensions to the Standard Library. Recentky Microsoft submitted a proposal to include these functions in ANSI C and C++ but that doesn't mean they are already standardized. So it all boils down to which OS and compiler you're using. If your standard headers (math.h, stdlib.h etc.) don't have these functions, then don't sweat it -- it's not just a matter of getting the header file bt also the binary lib files.
    C++ defines the <locale> library for locale-sensitive apps and wchar_t functions and classes. C has its own <locale.h> header.
    Danny Kalev

  3. #3
    Join Date
    Mar 2006
    1. I guess that if i intend to write it in a cross-platformed way (for Linux, MAC and Windows) i can't use the microsoft _atof_l.
    So what do you suggest to do if i have loads of atof/atol etc. in the code and i wish to make them locale-independent?

    2. What is the general method to make your software locale-independent?


  4. #4
    Join Date
    Nov 2003
    To ensure localizability, stick to wchar_t and the standard wchar_t functions. Almost every ANSI function that takes char * has a wchar_t equivalent: wstrstr, wstrcpy etc. These functions *are* standard so you can expect them to be supported on most platforms. What's not in the Standard yet is the _l functions so you should avoid them.
    Other than that, localization is a vast topic. To do it right, you need to plan in advance what yoru app is supposed to do and how much localization you want to offer: is it just the error messages being displayed in different languages? Or do you also intend to use different temperatures (Fahrenheit vs. Celsius), different decimal points (. or , ), date formats etc. The standard C++ <locale> library supports all of these but using it isn't exactly a trivial task.
    Danny Kalev

  5. #5
    Join Date
    Mar 2006
    So is there an easy way to force the locale of the loaded DLL to be as the locale of the application that loads it? Suppose i'm changing the locale of the loading application.

Similar Threads

  1. Platform Independent File System
    By java_van_dyk in forum Java
    Replies: 0
    Last Post: 07-25-2005, 03:34 PM
  2. Microsoft Cryptograhy - Not Working on Japanese Locale
    By gm_dwivedi in forum VB Classic
    Replies: 0
    Last Post: 07-25-2005, 05:48 AM
  3. GERMAN Locale :DB2 v7.2 installation on NT 4.0 platform
    By Avijeet Jayashekhar in forum Database
    Replies: 0
    Last Post: 08-13-2002, 05:51 AM
  4. Re: Is Visual Basic.NET platform independent?
    By Phil Weber in forum .NET
    Replies: 0
    Last Post: 06-01-2002, 12:19 AM
  5. Is VB-7.0 was platform Independent
    By Chandu in forum Talk to the Editors
    Replies: 1
    Last Post: 05-25-2000, 04:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center