9 Feb 13:00
[ swig-Patches-3486202 ] Allow use of malloc() in C++ mode
<SourceForge.net>
2012-02-09 12:00:03 GMT
2012-02-09 12:00:03 GMT
Patches item #3486202, was opened at 2012-02-09 04:00 Message generated for change (Tracker Item Submitted) made by kwwette You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=301645&aid=3486202&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Karl Wette (kwwette) Assigned to: Nobody/Anonymous (nobody) Summary: Allow use of malloc() in C++ mode Initial Comment: I would like to be able to make SWIG use malloc() for memory allocation in typemaps (using %new_instance, et. al), even when compiling in C++ mode. The reason is basically that malloc() is easier to replace with a custom allocation function than new(). For example, if I have a custom string type that needs to be allocated using a custom allocation function, I can do something like: #define malloc MyStringMalloc %fragment("SWIG_FromMyStringPtrAndSize" ... %typemaps_string(...) #undef malloc and still re-use SWIG's typemaps for strings using MyStringMalloc() instead of malloc(). The attached one-line patch to Lib/typemaps/swigmacros.swg makes SWIG use new() for memory allocation only if the symbol SWIG_CPLUSPLUS_USE_MALLOC is not defined. This symbol can then be defined on the command line to make SWIG use malloc() instead. The default behaviour remains the same. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=301645&aid=3486202&group_id=1645 ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/
RSS Feed