Re: Changing default alloc routines in C

Mario Emmenlauer <[email protected]> Thu, 15 Dec 2022 09:24:27 +0100
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
I'm not an actual SWIG developer and I don't know if my advise can help
you. But personally I found it quite easy to compile SWIG from sources.
This makes it quite easy to modify SWIG-internals. So maybe that would
be a "last resort" if you do not find another way?

All the best,

    Mario



On 15.12.22 06:25, Mayank Chaudhary wrote:
> Hi, I'm new to swig and am generating C wrappers using it.
> 
> Swig uses default malloc and calloc functions for memory allocations while generating wrappers. Is there any way where I can specify a custom allocation 
> function in the interface file and use that instead of malloc and calloc?
> 
> *For example - something like my_malloc, my_calloc and my_free or any custom func(I have defined these functions in a separate file) to be used everywhere 
> instead of malloc, calloc and free*
> 
> I tried typemaps and renaming functions but that didn't work.
> 
> Requesting your support.
> 
> Thanks & Regards,
> Mayank




_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user