This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: x86/64 alignment, optimization, -Wcast-align
I have no control over the memory allocation mechanism (it's an API I
implement, not something I developed, and has been in place for 10+
years), and I don't deallocate the memory handed over to me, I just
process the data the API presents me.
2016-10-26 0:36 GMT+02:00 Jeffrey Walton <noloader@gmail.com>:
> On Tue, Oct 25, 2016 at 6:24 PM, Balázs Oroszi <orobalage@gmail.com> wrote:
>> I don't allocate the memory, I write a DLL and memory is handed to me
>> as a byte array.
>
> In that case, you need to provide an allocator (and deallocator) so
> users of the DLL can allocate memory used by the DLL.
>
> Providing the allocator is similar to the way Microsoft's Net* APIs
> work. It avoids the problems with mismatched allocs/frees among
> programs and DLLs, and it ensures your alignment requirements are met.
> See, for example, NetApiBufferAllocate, NetApiBufferFree and
> https://msdn.microsoft.com/en-us/library/windows/desktop/aa370675(v=vs.85).aspx.
>
> Jeff
>
- References:
- x86/64 alignment, optimization, -Wcast-align
- Re: x86/64 alignment, optimization, -Wcast-align
- Re: x86/64 alignment, optimization, -Wcast-align
- Re: x86/64 alignment, optimization, -Wcast-align
- Re: x86/64 alignment, optimization, -Wcast-align