Author: mysqlpp
Date: Wed Oct 29 19:11:13 2008
New Revision: 2390
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2390&view=rev
Log:
First cut at new userman chapter on incorporating MySQL++ into one's own
project. VC++ and Eclipse sections done, OS X section probably done,
Unix and MinGW still half-done or less.
Added:
trunk/doc/userman/incorporating.dbx
Modified:
trunk/README-Visual-C++.txt
Modified: trunk/README-Visual-C++.txt
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/README-Visual-C%2B%2B.txt?rev=2390&r1=2389&r2=2390&view=diff
==============================================================================
--- trunk/README-Visual-C++.txt (original)
+++ trunk/README-Visual-C++.txt Wed Oct 29 19:11:13 2008
@@ -89,116 +89,9 @@
in a text editor to see how it works.)
-Using MySQL++ in an MFC Project
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- If you don't already have a project set up, open Visual Studio,
- say File > New > Project, then choose Visual C++ > MFC > MFC
- Application. Go through the wizard setting up the project as
- you see fit.
-
- Once you have your project open, right click on your top-level
- executable in the Solution Explorer, choose Properties, and make
- the following changes. (Where it doesn't specify Debug or Release,
- make the same change to both configurations.)
-
- o Append the following to C/C++ > General > Additional Include
- Directories:
-
- C:\Program Files\MySQL\MySQL Server 5.0\include,
- C:\mysql++\include
-
- o Under C/C++ > Code Generation change "Runtime Library" to
- "Multi-threaded Debug DLL (/MDd)" for the Debug
- configuration. For the Release configuration, make it
- "Multi-threaded DLL (/MD)".
-
- o Append the following to Linker > General > Additional Library
- Directories for the Debug configuration:
-
- C:\Program Files\MySQL\MySQL Server 5.0\lib\debug,
- C:\mysql++\vc\debug
-
- For the Release configuration, make it the same, but
- change the 'debug' directory names to 'opt'.
-
- o Under Linker > Input add the following to "Additional
- Dependencies" for the Debug configuration:
-
- libmysql.lib wsock32.lib mysqlpp_d.lib
-
- ...and then for the Release configuration:
-
- libmysql.lib wsock32.lib mysqlpp.lib
-
- This difference is because MySQL++'s Debug DLL and import
- library have a _d suffix so you can have both in the same
- directory without conflicts.
-
- You may want to study examples\vstudio\mfc\mfc.vcproj to see
- this in action. Note that some of the paths will be different,
- because it can use relative paths for mysqlpp.dll.
-
-
-Using MySQL++ in a Windows Forms C++/CLI Project
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Before you start work on getting MySQL++ working with your own
- program, you need to make some changes to the MySQL++ build
- settings. Open mysqlpp.sln, then right-click on the mysqlpp
- target and select Properties. Make the following changes for
- both the Debug and Release configurations:
-
- o Under Configuration Properties > General, change "Common
- Language Runtime support" to the /clr setting.
-
- o Under C/C++ > Code Generation, change "Enable C++ Exceptions"
- from "Yes (/EHsc)" to "Yes With SEH Exceptions (/EHa)"
-
- If you have already built MySQL++, be sure to perform a complete
- rebuild after changing these options. The compiler will emit
- several C4835 warnings after making those changes, which are
- harmless when using the DLL with a C++/CLI program, but which
- warn of real problems when using it with unmanaged C++. This is
- why MySQL++'s Windows installer (install.hta) offers the option
- to install the CLR version into a separate directory; use it if
- you need both managed and unmanaged versions installed!
-
- For the same reason, you might give some thought about where you
- install mysqlpp.dll on your end user's machines when distributing
- your program. My recommendation is to install it in the same
- directory as the .exe file that uses it, rather than installing
- into a system directory where it could conflict with a mysqlpp.dll
- built with different settings.
-
- Once you have MySQL++ built with CLR support, open your program's
- project. If you don't already have a project set up, open Visual
- Studio, say File > New > Project, then choose Visual C++ > CLR >
- Windows Forms Application. Go through the wizard setting up the
- project as you see fit.
-
- The configuration process isn't much different from that for an
- MFC project, so go through the list above first. Then, make the
- following changes particular to .NET and C++/CLI:
-
- o Under Configuration Properties > General change the setting
- from /clr:pure to /clr. (You need mixed assembly support
- to allow a C++/CLI program to use a plain C++ library
- like MySQL++.)
-
- o For the Linker > Input settings, you don't need wsock32.lib.
- The mere fact that you're using .NET takes care of that
- dependency for you.
-
- In the MFC instructions above, it said that you need to build it
- using the Multi-threaded DLL version of the C++ Runtime Library.
- That's not strictly true for MFC, but it's an absolute requirement
- for C++/CLI. See the Remarks in this MSDN article for details:
-
- http://msdn2.microsoft.com/en-us/library/k8d11d4s.aspx
-
- You may want to study examples\vstudio\wforms\wforms.vcproj to
- see all this in action. Note that some of the paths will be
- different, because it can use relative paths for mysqlpp_d.dll
- and mysqlpp.dll.
+Using MySQL++ in Your Own Projects
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ This is covered in the user manual, chapter 9.
Working With Bakefile
Added: trunk/doc/userman/incorporating.dbx
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/incorporating.dbx?rev=2390&view=auto
==============================================================================
--- trunk/doc/userman/incorporating.dbx (added)
+++ trunk/doc/userman/incorporating.dbx Wed Oct 29 19:11:13 2008
@@ -1,0 +1,263 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+<sect1 id="incorporating">
+ <title>Using MySQL++ in Your Own Project</title>
+
+ <para>Up to now, this manual has only discussed MySQL++ in
+ conjunction with the example programs that come with it. This chapter
+ covers the steps you need to take to incorporate MySQL++ into your own
+ projects.</para>
+
+ <para>The first thing you have to do is include
+ <filename>mysql++.h</filename> in each module that uses MySQL++.
+ In modules that use <link linkend="ssqls">SSQLS</link>, you also
+ need to include <filename>ssqls.h</filename>.<footnote><para>MySQL++
+ has many more header files, but don’t include any of them
+ directly. <filename>mysql++.h</filename> includes all of them for
+ you (except <filename>ssqls.h</filename> of course) in the correct
+ order.</para></footnote></para>
+
+ <para>At this point, your project probably won’t compile, and
+ it certainly won’t link. The steps to fix this are dependent
+ on your particular platform. The rest of this chapter is broken
+ up into several sections, one for each major platform type. These
+ sections are independent of each other. Feel free to ignore the
+ sections for platforms you don’t use.</para>
+
+
+ <sect2 id="inc-vstudio">
+ <title>Visual C++</title>
+
+ <sect3 id="inc-vstudio-mfc">
+ <title>Using MySQL++ in an MFC Project</title>
+
+ <para>If you don’t already have a project set up, open
+ Visual Studio, say File | New | Project, then choose Visual C++
+ | MFC | MFC Application. Go through the wizard setting up the
+ project as you see fit.</para>
+
+ <para>Once you have your project open, right click on your
+ top-level executable in the Solution Explorer, choose Properties,
+ and make the following changes. (Where it doesn’t
+ specify Debug or Release, make the same change to both
+ configurations.)</para>
+
+ <itemizedlist>
+ <listitem><para>Append the following to C/C++
+ | General | Additional Include Directories:
+ <filename>C:\Program Files\MySQL\MySQL Server 5.0\include,
+ C:\mysql++\include</filename></para></listitem>
+
+ <listitem><para>Under C/C++ | Code Generation change
+ “Runtime Library” to “Multi-threaded
+ Debug DLL (/MDd)” for the Debug configuration. For
+ the Release configuration, make it “Multi-threaded DLL
+ (/MD)”.</para></listitem>
+
+ <listitem>
+ <para>Append the following to Linker | General |
+ Additional Library Directories for the Debug configuration:
+ <filename>C:\Program Files\MySQL\MySQL Server 5.0\lib\debug,
+ C:\mysql++\vc\debug</filename></para>
+
+ <para>For the Release configuration, make it the same,
+ but change the “debug” directory names to
+ “opt”.</para>
+ </listitem>
+
+ <listitem>
+ <para>Under Linker | Input add the following to
+ “Additional Dependencies” for the Debug
+ configuration: <filename>libmysql.lib wsock32.lib
+ mysqlpp_d.lib</filename></para>
+
+ <para>...and then for the Release configuration:
+ <filename>libmysql.lib wsock32.lib
+ mysqlpp.lib</filename></para>
+
+ <para>This difference is because MySQL++’s Debug
+ DLL and import library have a <filename>_d</filename>
+ suffix so you can have both in the same directory without
+ conflicts.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>You may want to study
+ <filename>examples\vstudio\mfc\mfc.vcproj</filename>
+ to see this in action. Note that some of the paths will
+ be different, because it can use relative paths for
+ <filename>mysqlpp.dll</filename>.</para>
+ </sect3>
+
+
+ <sect3 id="inc-vstudio-wforms">
+ <title>Using MySQL++ in a Windows Forms C++/CLI Project</title>
+
+ <para>Before you start work on getting MySQL++ working with your
+ own program, you need to make some changes to the MySQL++ build
+ settings. Open <filename>mysqlpp.sln</filename>, then right-click
+ on the mysqlpp target and select Properties. Make the following
+ changes for both the Debug and Release configurations:</para>
+
+ <itemizedlist>
+ <listitem><para>Under Configuration Properties | General,
+ change “Common Language Runtime support” to the
+ /clr setting.</para></listitem>
+
+ <listitem><para>Under C/C++ | Code Generation, change
+ “Enable C++ Exceptions” from “Yes
+ (/EHsc)” to “Yes With SEH Exceptions
+ (/EHa)”</para></listitem>
+ </itemizedlist>
+
+ <para>If you have already built MySQL++, be sure to perform a
+ complete rebuild after changing these options. The compiler
+ will emit several C4835 warnings after making those changes,
+ which are harmless when using the DLL with a C++/CLI
+ program, but which warn of real problems when using it with
+ unmanaged C++. This is why MySQL++’s Windows installer
+ (<filename>install.hta</filename>) offers the option to install
+ the CLR version into a separate directory; use it if you need
+ both managed and unmanaged versions installed!</para>
+
+ <para>For the same reason, you might give some thought about
+ where you install <filename>mysqlpp.dll</filename> on your
+ end user’s machines when distributing your program.
+ My recommendation is to install it in the same directory as
+ the <filename>.exe</filename> file that uses it, rather than
+ installing into a system directory where it could conflict
+ with a <filename>mysqlpp.dll</filename> built with different
+ settings.</para>
+
+ <para>Once you have MySQL++ built with CLR support, open your
+ program’s project. If you don’t already have a
+ project set up, open Visual Studio, say File | New | Project,
+ then choose Visual C++ | CLR | Windows Forms Application.
+ Go through the wizard setting up the project as you see
+ fit.</para>
+
+ <para>The configuration process isn’t much different from
+ that for an MFC project, so go through the list above first.
+ Then, make the following changes particular to .NET and
+ C++/CLI:</para>
+
+ <itemizedlist>
+ <listitem><para>Under Configuration Properties | General
+ change the setting from /clr:pure to /clr. (You need mixed
+ assembly support to allow a C++/CLI program to use a plain C++
+ library like MySQL++.)</para></listitem>
+
+ <listitem><para>For the Linker | Input settings, you
+ don’t need <filename>wsock32.lib</filename>. The mere
+ fact that you’re using .NET takes care of that dependency
+ for you.</para></listitem>
+ </itemizedlist>
+
+ <para>In the MFC instructions above, it said that you need to
+ build it using the Multi-threaded DLL version of the C++ Runtime
+ Library. That’s not strictly true for MFC, but it’s
+ an absolute requirement for C++/CLI. See the Remarks in <ulink
+ url="http://msdn.microsoft.com/en-us/library/k8d11d4s.aspx">the
+ MSDN article on the /clr switch</ulink> for details.</para>
+
+ <para>You may want to study
+ <filename>examples\vstudio\wforms\wforms.vcproj</filename>
+ to see all this in action. Note that some of the
+ paths will be different, because it can use relative
+ paths for <filename>mysqlpp_d.dll</filename> and
+ <filename>mysqlpp.dll</filename>.</para>
+ </sect3>
+ </sect2>
+
+
+ <sect2 id="inc-unix">
+ <title>Unixy Platforms: Linux, *BSD, OS X, Cygwin, Solaris...</title>
+
+ <sect3 id="inc-unix-makefile">
+ <title>Generic Makefiles</title>
+
+ <para>Bla.</para>
+ </sect3>
+
+ <sect3 id="inc-autotools">
+ <title>GNU Autotools: autoconf, automake...</title>
+
+ <para>Bla.</para>
+ </sect3>
+ </sect2>
+
+
+ <sect2 id="inc-osx">
+ <title>OS X</title>
+
+ <sect3 id="inc-osx-makefile">
+ <title>Makefiles</title>
+
+ <para>The <link linkend="inc-unix-makefile">generic Makefile
+ instructions above</link> cover most of what you need to know
+ about using Makefiles on OS X.</para>
+
+ <para>One thing that may trip you up on OS X is that it uses an
+ uncommon dynamic linkage system. The easiest way to cope with
+ this is to link your executables with the compiler, rather than
+ call <filename>ld</filename> directly.</para>
+
+ <para>Another tricky bit on OS X is the concept of Universal
+ binaries. See <filename>README-Mac-OS-X.txt</filename> for
+ details on building a Universal version of the MySQL++ library,
+ if you need one. By default, you only get a version tuned for
+ the system type you build it on.</para>
+ </sect3>
+
+ <sect3 id="inc-osx-xcode">
+ <title>Xcode</title>
+
+ <para>I have no information on how to incorporate MySQL++ in
+ an Xcode project. Send a message to the MySQL++ mailing list
+ if you can help out here.</para>
+ </sect3>
+ </sect2>
+
+
+ <sect2 id="inc-mingw">
+ <title>MinGW</title>
+
+ <sect3 id="inc-mingw-makefile">
+ <title>Makefiles (mingw32-make)</title>
+
+ <para>The <link linkend="inc-unix-makefile">generic Makefile
+ instructions above</link> apply to MinGW’s version of
+ GNU make as well. This section will only cover the differences
+ particular to MinGW.</para>
+ </sect3>
+
+ <sect3 id="inc-mingw-ide">
+ <title>Third-Party IDEs (Dev-C++, Code::Blocks...)</title>
+
+ <para>I have no information on how to do this. We’ve
+ received reports on the mailing list from people that have made
+ it work, but no specifics on what all needs to be done. The
+ Makefile discussion above should give you some hints.</para>
+ </sect3>
+ </sect2>
+
+
+ <sect2 id="inc-eclipse">
+ <title>Eclipse</title>
+
+ <para>As far as I can tell, the simplest way to build a C++
+ project with Eclipse is to set up a Makefile for it as described
+ <link linkend="inc-unix-makefile">above</link>, then add an
+ external run configuration for your local make tool. Get the
+ project building from the command line with make, then go to Run |
+ External Tools | Open External Tools Dialog and add a new launch
+ configuration.</para>
+
+ <para>For example, on my OS X system I use
+ <filename>/usr/bin/gnumake</filename> for the program location
+ and pick the project root with the Browse Workspace button to
+ set the working directory.</para>
+ </sect2>
+</sect1>
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits