From 77ccb3b64d8e2bccce1b2780ae1b0cca0cc1647b Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@wien.gv.at>
Date: Mon, 17 Oct 2016 16:44:00 +0200
Subject: [PATCH 2/2] Add instructions for building C functions with MSVC

---
 doc/src/sgml/dfunc.sgml |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/doc/src/sgml/dfunc.sgml b/doc/src/sgml/dfunc.sgml
index 6a4b7d6..8234514 100644
--- a/doc/src/sgml/dfunc.sgml
+++ b/doc/src/sgml/dfunc.sgml
@@ -205,6 +205,27 @@ gcc -G -o foo.so foo.o
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term>
+     <systemitem class="osname">Windows with MSVC</>
+     <indexterm><primary>Windows</><secondary>shared library</></>
+    </term>
+    <listitem>
+     <para>
+      Windows does not use <acronym>PIC</acronym>, so the shared library
+      has to be linked with the PostgreSQL server's import library
+      <filename>postgres.lib</filename>.
+      The object file will be named <filename>foo.obj</filename>
+      and the shared library will be named <filename>foo.dll</filename>.
+      The compiler flag to create a shared library is <option>/LD</option>.
+<programlisting>
+cl /c foo.c
+cl /LD /Fe:foo.dll foo.obj postgres.lib
+</programlisting>
+     </para>
+    </listitem>
+   </varlistentry>
+
   </variablelist>
 
  <tip>
-- 
1.7.1

