On 20/12/10 22:04, Julian Taylor wrote:
> Hi,
> attached are two patches fixing minor compilation problems for gcc.
> 
> patches:
> 0002 of them removes the char* message of a bad_cast.
> bad_cast(const char*) is non-standard (18.5.2 c++98 18.7.2 c++0x) it
> won't compile with gcc 4.5

Argh, it must be one of changes I applied with Visual C++
last night without following with test on Linux.

> maybe soci_error should be used instead?

I'm still not convinced myself to sinking all types of exceptions
in single soci_error.
Perhaps, we should have a small hierarchy of exceptions in SOCI?

Where is the balance... :-)

> 0001 just adds missing includes.
> 
> but this brings me to another point:
> the #includes in the soci headers are all just filenames without paths
> this creates a problem when users include the main header and a backend
> header like this:
> #include <soci/soci.h>
> #include <soci/sqlite3/soci-sqlite3.h>
> and forget to add -I/usr/include/soci.

I completely agree. This is the kind of mess I don't like myself in a
software. I highly respect structured #includes using qualified paths.

Maciej is on holiday now but I'll try to ask if this wouldn't be too
much destructive for his purposes.

> This leads to an error message not easily understood by beginners as it
> not originates from their own code:
> /usr/include/soci/sqlite3/soci-sqlite3.h:27:26: fatal error:
> soci-backend.h: No such file or directory

Good point.

> see also the bug reports:
> https://bugs.launchpad.net/ubuntu/+source/soci/+bug/529376
> https://bugs.launchpad.net/ubuntu/+source/soci/+bug/690479

I haven't seen those. Thanks for pointing.

> While this is a user error (they should add the include path to the
> compiler) I'm wondering if this can be avoided by changing the includes
> to relative paths in the soci header directory:
> #include <soci/soci-backend.h>
> This the avoids the need for the -I/usr/include/soci
> The boost headers do it like this too.

I like this idea very much.

> The alternative would be to update the documentation to mention the
> required include path.

I'd rather fix SOCI :-)

> Another good addition for easier use would be to add pkg-config support
> I could provide a patch for this if you wish

Indeed. I also have soci_config program on my long TODO list like
pg_config and friends.

Julian, thanks for the great help as always!

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to