Closed davidbien closed 2 years ago
Thanks a lot for reporting this issue. And especially for providing this nice little workaround. Will add that right now.
Wow – that was fast. Thanks. I reviewed just for completeness and it seems that the changes to the source correspond to my local changes.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Andreas @.> Sent: Thursday, February 10, 2022 4:59 AM To: @.> Cc: David L. @.>; @.> Subject: Re: [KhronosGroup/Vulkan-Hpp] Under MSVC the debug allocation macros conflict with the methods free()... (Issue #1200)
Closed #1200https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKhronosGroup%2FVulkan-Hpp%2Fissues%2F1200&data=04%7C01%7C%7Ca9ed6f25781543f41a0e08d9ec8ccffc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800911794748461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PaoeUZc%2Fdj2z5pVfeuLUPTGgnm%2BcACw0zFjm81SGsQk%3D&reserved=0 via #1201https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKhronosGroup%2FVulkan-Hpp%2Fpull%2F1201&data=04%7C01%7C%7Ca9ed6f25781543f41a0e08d9ec8ccffc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800911794748461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=EXCgFtIvJW9M5mfbACkFO%2FND2vP9wGsjHKvergckdvo%3D&reserved=0.
— Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKhronosGroup%2FVulkan-Hpp%2Fissues%2F1200%23event-6041579456&data=04%7C01%7C%7Ca9ed6f25781543f41a0e08d9ec8ccffc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800911794748461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=eLnW0NrW0%2BiQXbgkH7iepZ8KskDiNckLCg97cbb%2BQFQ%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKSVVVA3B44OLOJFMT2WA4TU2OSCTANCNFSM5N7RR25A&data=04%7C01%7C%7Ca9ed6f25781543f41a0e08d9ec8ccffc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637800911794748461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=umXmR7dukTqkZRAWE%2BMVcRtK0h53qCgZXPL%2Fd%2F2gmgw%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>
The debug heap macros under MSVC are, unfortunately, named the same as the normal c methods.
So, free is defined as:
#define free(p) _free_dbg(p, _NORMAL_BLOCK)
It is really nice to be able to use the debug heap to find memory leaks.Luckily, there is an easy fix that I have applied locally, for each instance enclose the name free in parenthesis and this prevents looking up the preprocessor macro. i.e.:
becomes:
The other solution is to change the methods to a name that doesn't clash with the macro, i.e. vkfree() for instance.
Repro:
Now compile anything...