Writing PostgreQL C Functions On Windows
Writing PostgreQL C Functions On Windows
Writing PostgreQL C Functions On Windows
C Functions and
C User Defined Types
on Windows
Using Visual Studio (C++)
By Tim Child
November 2010
Biography
• Tim Child
• 35 years experience in software development
• Formerly
– VP Oracle Corporation
– VP BEA Systems Inc.
– VP Informix
• 30 + years experience in 3D, CAD, GIS and
DBMS
Learn Teach Learn
Lecture 5%
Read 10%
Demonstration 30%
• declspec(dllexport)
• .def file
• Linker Command
#define WIN32_LEAN_AND_MEAN
#define NOCOMM
#define WIN32_LEAN_AND_MEAN
#define NOCOMM
• Setting up the $libdir variable, allows PostgreSQL to find the DLL's to load
http://www.ucware.com/apev/index.htm
Information Resources
• Contrib Directories
– Many examples of C Functions
• pGFoundry
– More examples of C Functions
• PostgreSQL Doxygen
– Very useful for reverse engineering
VS Tool Box
Drag and Drop Code Snippets
Wish List
Here is a list of things in no particular priority that would help the development of
PostgreSQL C Functions on Windows.
• A quicker way to unload DLL’s so they can be copied without re-starting the server.
• A Visual Studio PostgreSQL syntax checker. Intelli-sense provides great value but
wants to syntax check SQL files against SQL Server syntax.
• A Visual Studio Add-in to execute SQL queries directly from the VS Tool.
Q&A