git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/1] Simplify loading of DLL functions on Windows

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 25, 2017, 16:06 UTC
Message-ID
<cover.1506355545.git.johannes.schindelin@gmx.de>
In-Reply-To
<f5a3add27206df3e7f39efeac8a3c3b47f2b79f2.1505834586.git.johannes.schindelin@gmx.de>
Changes since v1:
- repeated the example from the commit message in the .h file
- mentioned that the function is not thread-safe.
- added Jonathan's Reviewed-by: footer
Johannes Schindelin (1):
  Win32: simplify loading of DLL functions
 compat/win32/lazyload.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 compat/win32/lazyload.h
base-commit: 28996cec80690d2322359d3650a57e8de6e01eb6
Published-As: https://github.com/dscho/git/releases/tag/lazyload-v2
Fetch-It-Via: git fetch https://github.com/dscho/git lazyload-v2
Interdiff vs v1:
 diff --git a/compat/win32/lazyload.h b/compat/win32/lazyload.h
 index 91c10dad2fb..9e631c8593f 100644
 --- a/compat/win32/lazyload.h
 +++ b/compat/win32/lazyload.h
 @@ -1,7 +1,19 @@
  #ifndef LAZYLOAD_H
  #define LAZYLOAD_H
  
 -/* simplify loading of DLL functions */
 +/*
 + * A pair of macros to simplify loading of DLL functions. Example:
 + *
 + *   DECLARE_PROC_ADDR(kernel32.dll, BOOL, CreateHardLinkW,
 + *                     LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
 + *
 + *   if (!INIT_PROC_ADDR(CreateHardLinkW))
 + *           return error("Could not find CreateHardLinkW() function";
 + *
 + *   if (!CreateHardLinkW(source, target, NULL))
 + *           return error("could not create hardlink from %S to %S",
 + *                        source, target);
 + */
  
  struct proc_addr {
  	const char *const dll;
 @@ -20,6 +32,7 @@ struct proc_addr {
   * Loads a function from a DLL (once-only).
   * Returns non-NULL function pointer on success.
   * Returns NULL + errno == ENOSYS on failure.
 + * This function is not thread-safe.
   */
  #define INIT_PROC_ADDR(function) \
  	(function = get_proc_addr(&proc_addr_##function))
-- 
2.14.1.windows.1.1024.gf2dea585d74.dirty
Previous: Junio C HamanoNext: Johannes Schindelin
Message 7 of 9 in “Win32: simplify loading of DLL functions”
  1. Win32: simplify loading of DLL functionsJohannes Schindelin, Sep 19, 2017
  2. Jonathan NiederSep 19, 2017
  3. Junio C HamanoSep 20, 2017
  4. Johannes SchindelinSep 20, 2017
  5. Jonathan NiederSep 20, 2017
  6. Junio C HamanoSep 21, 2017
  7. 0/1 Simplify loading of DLL functions on WindowsJohannes Schindelin, Sep 25, 2017
  8. 1/1 Win32: simplify loading of DLL functionsJohannes Schindelin, Sep 25, 2017
  9. Jonathan NiederSep 25, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.