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

Re: Learning Subversion's Client C API

From: Martin Piecyk <mpiecyk_at_gmail.com>
Date: 2006-08-18 20:24:29 CEST

On 8/17/06, Garrett Rooney <rooneg@electricjellyfish.net> wrote:
> On 8/17/06, Martin Piecyk <mpiecyk@gmail.com> wrote:
> > Hello,
> >
> > I am a developer who wants to build a client application using
> > Subversion's C client API. Running on Windows XP, I downloaded
> > http://subversion.tigris.org/files/documents/15/32474/svn-win32-1.3.2_dev.zip
> > and http://subversion.tigris.org/files/documents/15/32473/svn-win32-1.3.2.zip
> > to gain access to the header files and pre-compiled static libraries.
> > I read the entire Subversion book located in the Windows .exe
> > installation (since it was newer than
> > http://svnbook.red-bean.com/en/1.1/index.html), including the chapter
> > for developers. I understand Subversion's use of APR's memory pools
> > and reasons for doing so and the modularized layered library design,
> > such as the libraries for the Repository Access and Repository layers.
> > Additionally, I looked read through Subversion's documentation in
> > http://svn.collab.net/svn-doxygen/, looking mostly at the client
> > functions and data types, and the APR documentation in
> > http://apr.apache.org/docs/apr/, http://apr.apache.org/docs/apr-util/,
> > and http://apr.apache.org/docs/apr-iconv/. I read through
> > http://subversion.tigris.org/hacking.html and a tutorial using the
> > client API at http://www.linuxdevcenter.com/pub/a/linux/2003/04/24/libsvn1.html
> > (but this uses an older version of Subversion).
> >
> > However, after reading all of these documents, I still do not know how
> > to make a simple console application in C that does something with
> > Subversion such as checkout a repository into a particular directory
> > using a particular user name and password. I believe that in all of
> > the aforementioned papers I read through, none had a complete working
> > example written in the C or C++ language with a "main" function. I was
> > hoping that maybe someone knew of a tutorial that can help someone
> > such as myself get off to a good start with developing with the
> > Subversion API. Looking through the actual source code of the command
> > line client, svn.exe, confused me since I was not sure which lines of
> > code I would need for performing a simple checkout and what the
> > purpose of each line was.
> >
> > Eventually, I found
> > http://svn.collab.net/repos/svn/trunk/tools/examples/, but I could not
> > get any of the C files to compile with Microsoft Visual C++ 6.0.
> > Additionally, they seemed a bit complicated to me since there were
> > several lines of code I wasn't sure of but no tutorial that goes
> > through them line by line.
> >
> > Here is my error output of headrev.c, which is in the examples
> > directory. All of the other C files in the examples directory I
> > compiled had similar errors.
> >
> > --------------------Configuration: subversionheadnumber - Win32
> > Debug--------------------
> > Compiling...
> > headrev.c
> > E:\subversionheadnumber\headrev.c(132) : warning C4013:
> > 'svn_io_open_unique_file2' undefined; assuming extern returning int
> > E:\subversionheadnumber\headrev.c(132) : error C2065:
> > 'svn_io_file_del_on_close' : undeclared identifier
> > E:\subversionheadnumber\headrev.c(132) : warning C4047: 'initializing'
> > : 'struct svn_error_t *' differs in levels of indirection from 'int '
> > Error executing cl.exe.
> >
> > subversionheadnumber.exe - 1 error(s), 2 warning(s)
> >
> > Does anyone know of any tutorials on using the C client API of
> > Subversion 1.3 or other example programs? Also, does anyone know what
> > my problems are with compiling the source code? I used the development
> > files in svn-win32-1.3.2_dev.zip to attempt to compile the source. Any
> > help or links would be greatly appreciated.
> I imagine you're getting those errors because you're not including all
> the necessary header files. That particular error seems to result
> from not including svn_io.h (not sure why headrev.c would have that
> problem, but it's certainly possible).
> The best example program is probably minimal_client.c, although I
> don't know of an up to date tutorial to go along with it.
> -garrett
I also noticed that svn_io.h wasn't included, so I added #include
"svn_io.h" before all of the other includes, yet I still received the
same error. Then I realized that this error occurred because the HEAD
version of those example files do not compile with the header files of
Subversion 1.3.2.

Therefore, I downloaded the minimal_client.c file from
http://svn.collab.net/repos/svn/tags/1.3.2/tools/examples/ and tried
compiling it with the headers and libraries in svn-win32-1.3.2_dev.zip
but I received many link errors. The instructions in the example
documentation state to use this command to compile:

cc minimal_client.c -o minimal_client \
-I/usr/local/include/subversion-1 -I/usr/local/apache2/include \
-L/usr/local/apache2/lib -L/usr/local/lib \
-lsvn_client-1 -lapr-0 -laprutil-0

but I'm using Windows with MS Visual C++ 6 so I set the paths
correctly and used these three additional libraries, based on the
example compilation instructions:

libsvn_client-1.lib libapr.lib libaprutil.lib

Here are the link errors I received:

----Configuration: svn_minimal_client - Win32 Debug----
e:\svn_minimal_client\minimal_client.c(143) : warning C4013:
'svn_cmdline_init' undefined; assuming extern returning int
minimal_client.obj : error LNK2001: unresolved external symbol _svn_auth_open
minimal_client.obj : error LNK2001: unresolved external symbol
minimal_client.obj : error LNK2001: unresolved external symbol
minimal_client.obj : error LNK2001: unresolved external symbol
minimal_client.obj : error LNK2001: unresolved external symbol

I looked at the documentation of svn_auth_open, the first error, and
it seems I need libsvn_auth, but I did not receive this library in
svn-win32-1.3.2_dev.zip. Does anyone have any ideas?


To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Aug 18 20:26:23 2006

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.