[redland-dev] Redland for Revolution & questions

Suzan Foster su at islief.nl
Fri Oct 15 13:06:01 BST 2004


On Oct 15, 2004, at 11:43 AM, Dave Beckett wrote:

> On Thu, 14 Oct 2004 13:54:23 +0200, Suzan Foster <su at islief.nl> wrote:
>
>>> It's usually an issue with runtimes when you get memory exceptions in
>>> dll's. I was having similar problems with raptor code. When compiling
>>> with VC++ check that you're building all libraries with /MD for
>>> release and /MDd for debug, /MT and /MTd for the executable. With  
>>> your
>>> code it sounds like you're passing file handles over runtime
>>> boundaries.
>
> Could you expand on that a bit more?  What do those options do?
> Seems this is worth recording for others building redland on win32.
> I'll add it to http://librdf.org/notes/porting.html and maybe promote
> it to core docs.

Basicallly there are multiple runtimes which a Win32 application can  
link to in single-threaded and multi-threaded flavours. Passing  
pointers between different runtimes, which happens if dynamic libraries  
and applications are linked against different runtimes, causes memory  
access violations because one runtime is accessing memory which belongs  
to a different runtime. Using the right compiler switches forces all  
components to use the same runtime. /ML will force the single-threaded  
runtime, whilst /MT will force the double-threaded runtime. Appending a  
lower case d will force the single-threaded debug runtime and the  
multi-threaded runtime respectively. Using /LD will crate a dynamic  
library (dll) and default to /MT if not overridden by /ML. Using /MD  
will create a dynamic library and force /MT.

My own set of dynamic libraries (raptor.dll, rasqal.dll and librdf.dll)  
were all compiled with the option /MDd and can safely pass memory  
amongst each other. N.B. libxml2.dll also needs to be linked to the  
same runtime, especially when using the rss-tag-soup parser.

A more extensive description of the compiler options can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ 
vccore/html/_core_.2f.md.2c_2f.ml.2c_2f.mt.2c_2f.ld.asp

grtz, su.(hth)




More information about the redland-dev mailing list