1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 #include <sal/config.h>
17 namespace sal::systools
19 // Linking to odbccp32 requires also legacy_stdio_definitions; and that breaks
20 // in some configurations, with make error 139. Load it dynamically instead.
25 : m_hDLL(LoadLibraryW(L
"odbccp32.dll"))
28 ~odbccp32() { FreeLibrary(m_hDLL
); }
30 bool SQLGetInstalledDrivers(LPWSTR sBuf
, WORD nBufSize
) const
32 using proc_t
= BOOL
__stdcall(LPWSTR
, WORD
, WORD
*);
33 return Invoke
<proc_t
>("SQLGetInstalledDriversW", sBuf
, nBufSize
, nullptr);
36 bool SQLManageDataSources(HWND hwndParent
)
38 using proc_t
= BOOL
__stdcall(HWND
);
39 return Invoke
<proc_t
>("SQLManageDataSources", hwndParent
);
43 template <typename proc_t
, typename
... Args
> bool Invoke(const char* func
, Args
... args
) const
45 if (auto pFunc
= reinterpret_cast<proc_t
*>(GetProcAddress(m_hDLL
, func
)))
46 return pFunc(args
...);
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */