1/* Copyright 2011 Google Inc. All Rights Reserved.
2**/
3
4#include <windows.h>
5#include "unicode/udata.h"
6
7/*
8** This function attempts to load the ICU data tables from a DLL.
9** Returns 0 on failure, nonzero on success.
10** This a hack job of icu_utils.cc:Initialize().  It's Chrome-specific code.
11*/
12
13#define ICU_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
14int sqlite_shell_init_icu() {
15  HMODULE module;
16  FARPROC addr;
17  UErrorCode err;
18
19  // Chrome dropped U_ICU_VERSION_SHORT from the icu data dll name.
20  module = LoadLibrary(L"icudt.dll");
21  if (!module)
22    return 0;
23
24  addr = GetProcAddress(module, ICU_DATA_SYMBOL);
25  if (!addr)
26    return 0;
27
28  err = U_ZERO_ERROR;
29  udata_setCommonData(addr, &err);
30
31  return 1;
32}
33