Douglas Pratley wrote:
> We went through upgrades from MSCV 6 -> 7.1 -> 8 in my last job. The
> only real problem we ran into (apart from all the code tweaks in the C++
> to make it compile 6 -> 7.1, which is not relevant here) was in passing
> dynamically allocated memory across binary boundaries.
> 
> If everyone has followed the guidelines and used the "g_" functions for
> allocation and deallocation, then all memory should be being allocated
> from one CRT, so it may well just all "work". Would it be worth checking
> the code to make sure that it doesn't use other allocation functions
> anywhere?

If those are the documented guidelines, the documentation needs to be 
updated - the ep_ and se_ routines are what dissectors should use in 
almost all cases (so that they don't have to worry about freeing what 
they allocate).

On Windows, those allocators use VirtualAlloc() directly (to stuff guard 
pages into the memory space), so they bypass the C runtime.  (On UN*X, 
they use mmap() to achieve the same goal if possible, and use g_malloc() 
otherwise - as far as I know, though, UN*X C environments typically 
don't have multiple incompatible memory allocators.)

However, I seem to remember the WinPcap developers saying that passing 
FILE *'s and even "file descriptors" (as returned by _open(), _fdopen(), 
etc.) across binary boundaries is problematic as well.
_______________________________________________
Wireshark-dev mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-dev

Reply via email to