Re: x86/64 alignment, optimization, -Wcast-align

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>:
> On Tue, Oct 25, 2016 at 6:24 PM, Balázs Oroszi <orobalage@xxxxxxxxx> 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
>




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux