[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn_client_status3 causing access violation; what am I doing wrong?

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Fri, 20 Mar 2009 20:28:35 +0100

> -----Original Message-----
> From: Rick Yorgason [mailto:rick_at_ldagames.com]
> Sent: Friday, March 20, 2009 11:08 AM
> To: users_at_subversion.tigris.org
> Subject: svn_client_status3 causing access violation; what am I doing
> wrong?
>
> Hey everbody,
>
> I'm trying to do something pretty simple with libsvn; just pass in the
> name of a file which is under source control, and retrieve the status.
> Unfortunately, my call to svn_client_status3 is just causing an access
> violation with no useful error status. Any idea what I'm doing wrong?

I think you miss some essential initializations of the APR and Subversion
libraries.

You could look at
http://svn.collab.net/repos/svn/trunk/tools/examples/minimal_client.c

to see what a minimal client could do to initialize the libraries properly.
(The example is somewhat outdated; you get a few deprecation warnings when
you use it on 1.6.0; but our compatibility guarantees promise that this
should work until 2.0)

In SharpSvn I use the following methods for global initialization:
apr_initialize()
svn_dso_initialize()
svn_utf_initialize()
svn_fs_initialize()

(SharpSvn doesn't initialize like a commandline tool, so I can't use
svn_cmdline_*()).

Thanks,
        Bert
>
> Thanks; source follows.
>
> -Rick-
>
> #include <iostream>
> #include <exception>
>
> #include <svn_pools.h>
> #include <svn_client.h>
>
> using namespace std;
>
> void statusFunc(void *baton, const char *path, svn_wc_status2_t
> *status)
> {
> cout << "Test\n";
> }
>
> int main()
> {
> apr_allocator_t *allocator;
> apr_pool_t* pPool;
> if(apr_allocator_create (&allocator))
> throw exception("Could not create top-level allocator.");
>
> apr_allocator_max_free_set (allocator,
> SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
>
> pPool = svn_pool_create_ex (NULL, allocator);
> if(!pPool)
> throw exception("Could not create memory pool.");
>
> svn_client_ctx_t* ctx;
> svn_error_t* pError = svn_client_create_context(&ctx, pPool);
> if(pError)
> throw exception(pError->message);
>
> apr_pool_t* pSubpool = svn_pool_create(pPool);
> if(!pSubpool)
> throw exception("Could not create subpool.");
>
> svn_client_status3(NULL,
> "D:/Projects/hegemony.trunk/Release/Resources/Sounds/Ballista/Ballista_
> Creaks_Big_01.ogg",
> NULL, &statusFunc, NULL, svn_depth_infinity, true, false, true, false,
> NULL, ctx, pSubpool);
>
> return 0;
> }
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessage
> Id=1363389
>
> To unsubscribe from this discussion, e-mail: [users-
> unsubscribe_at_subversion.tigris.org].

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1366741

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-03-20 20:29:36 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.