I try to forbid the use of a method, to have a compile error if some piece of code use it.
This is a proprietary legacy module, that I know that some methods are problematic. We have headers files, and dlls.
I can't figure out all the use of this method in the huge project I use (lot of defines, some implicit cast...)
Can the compiler stop (or just warn) if it detect the use of this method?
You can use __declspec(deprecated)
in Visual C++ to generate warnings for use of a specific function. You can use #pragma deprecated
to deprecate the usage of any symbol (including macros).
See more information on MSDN . This can generate warnings or errors (depending on computer flags) but you can supress them where needed with additional #pragma
s
Well, not sure if it works or not (so please correct me), but you might want to play with making libs out of your DLLs
something along the line, from VS command prompt:
dumpbin /exports yourdll.dll
you'll get export symbols output and copy it into .def file
edit .def file to remove unwanted symbols
make lib and link it to your app
lib /def:C:\mydef.def /OUT:C:\mylib.lib
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.