views:

628

answers:

2

Following on the tails of my previous (answered) question...

SharpSvn makes calling the Subversion client API simple:

SvnClient client = new SvnClient();
client.Authentication.DefaultCredentials = new NetworkCredential(username, password);
client.CheckOut(new Uri("http://xxx.yyy.zzz.aaa/svn/repository"), workingCopyDir);

On the other hand, calling the client API from C/C++, as shown in minimal_client.c requires coding "closer to the metal", as it were, on Subversion.

*Are there Windows libraries for C++ in Visual Studio 2003 that present a simpler interface than what minimal_client uses?*

If there are not, *is there a VS2003 C++ project (a .vcproj file) that demonstrates getting minimal_client to run?* I'm able to compile minimal_client.c and link it using the following libraries:

libsvn_client-1.lib libsvn_delta-1.lib libsvn_diff-1.lib libsvn_fs-1.lib libsvn_fs_base-1.lib libsvn_fs_fs-1.lib libsvn_ra-1.lib libsvn_ra_local-1.lib libsvn_ra_svn-1.lib libsvn_repos-1.lib libsvn_subr-1.lib libsvn_wc-1.lib libapr-1.lib libaprutil-1.lib xml.lib libneon.lib

but when I run my application (in the debugger or start the release build without debugging), it runs for about 20 seconds without hitting the first line of main() and then throws this exception:

An unhandled exception of type 'System.TypeLoadException' occurred in Unknown Module.

Additional information: Could not load type apr_pool_t from assembly minimal_client, Version=1.0.3477.16033, Culture=neutral, PublicKeyToken=null.

I've tried various combination of libsvn_*.lib and svn_*.lib to no avail.

Any thoughts on what I'm doing wrong?

EDIT: I started fresh with a "Win32 Console Project" (still in VS2003) and I am now able to debug the first few lines of my app. But now, on this line:

if (svn_cmdline_init ("minimal_client", stderr) != EXIT_SUCCESS)

I get a different exception (in the debugger or start the release build without debugging):

Unhandled exception at 0x7c91b21a in Win32ConsoleProject_minimal_client.exe: 0xC0000005: Access violation writing location 0x00000010.

EDIT: This thread explains that this error is a CRT mismatch between svn and stderr in my app. If I don't want to build Svn so they match (I don't want to), I can pass NULL instead of stderr (provided I'm willing to do without messages that would go to stderr) When I did this, my app ran all the way through correctly.

A: 

Can you upgrade to Visual C++ 2005 ? If so, you could just go using SharpSvn with C++/CLI.

Or even maybe stick to VC2003 and go SharpSvn with Managed C++ ? (not that I have any knowledge on the how od even the if)

edit: oh well, SharpSvn's homepage explicitely states that VC++ 2005 SP1 is required...

RaphaelSP
Circumstances prevent migrating to 2005.
JeffH
+1  A: 

It seems that C++ wrappers are not overflowing the 'net. However, you may want to try SVNCPP, which can be yoinked from RapidSVN.

See http://rapidsvn.tigris.org/ for details (note: I've not tried it).

RaphaelSP
That was all I found too. Should I be worried that it's called "0.9.8"?
JeffH
I don't think so, it seems that the application has been around for at least three years, so the C++ wrapper should be pretty usable. Especially with a version number that close to 1.
RaphaelSP
I'm accepting this because, along with your comment that starts "Is that a Managed C++ project ?", I got what I needed for now. Thanks!
JeffH
By the way, if you decide to create your own simpler wrapper, I'll be interested !
RaphaelSP