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

Re: [PATCH] dynamically link swig runtime on windows (Can I commit this?)

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-08-01 07:42:10 CEST

Brandon Ehle wrote:
> Russell Yanofsky wrote:
>
>> I was recently given commit access for the swig bindings, but I'd
>> like to check in some changes to the build generator. A patch is
>> attached. Is it ok for me to check this in?
>>
>> Log Message:
>>
>> Changed Visual Studio builds of SWIG bindings to dynamically link
>> with the SWIG runtime instead of statically linking with it.
>> (Makefile builds already do this). This is needed because the
>> SWIG runtime functions read and write global data. When static
>> linking is used each module gets its own incomplete copy of the
>> global data, now data is shared and accessible to all modules.
>>
>> * build/win32/gen_swig_runtime.bat:
>> new batch script which generates swig runtime code for
>> various languages
>>
>>
>>
>>
> Excuse my ignorance, but what does this batch file actually do?

It outputs C source files containing the swig runtime functions for various
languages. The code on top is basically just error checking. The actual
functionality is implemented in separate sections for each language. For
example, here is the section that generates the python runtime source:

  :python
  ECHO #include "Python.h" > %2
  TYPE "%swig_lib%\common.swg" >> %2
  TYPE "%swig_lib%\python\pyrun.swg" >> %2
  GOTO success

That's not too complicated. It generates a file containing an include line,
some functions from the swig library, and some python specific functions
from the swig library.

> Like
> cmpilato said, its Greek to me. Couldn't we do this in a much cleaner
> and OS independent way?

This is only needed for the Visual Studio projects that build swig bindings.
Other platforms use the Runtime/Makefile.in file that comes with swig (and
which this file is based on).

>
> I notice the section of code at the top does the following:
>
> REM Enable Command Extensions, needed for FOR command below
> SETLOCAL ENABLEEXTENSIONS
> IF ERRORLEVEL 1 (
> ECHO Error: Unable to enable command extensions >&2
> EXIT /B 1
> )
>
> Before we depend on something like this, shouldn't we implement a
> fallback case for when those extensions are not available?

The extensions are always available on Windows NT/2K/XP/2K3 unless the user
sets a special registry key to disable them, and this is very rare so a
warning message should be sufficient.

Also, my response to cmpilato in this thread has a new version attached
which is ported to Windows 9x and doesn't require the command extensions.

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 1 07:44:44 2003

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

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