문제

I would like to selectively compile part of an (extremely bloated and large) framework only as the elements are used.

I've had a few ideas on how I can do this, but failed to implement either properly;

  1. Use a define macro with the same name as a class or method which toggles a variable which causes that part of the framework to be included by the preprocessor. I had an idea for an implementation of this but got stuck.

  2. Find a way to have all my function defined as templates so that the compiler doesn't generate them until they are required. I'm unsure however how I can make this work in a multi-file project.

Is there a good way to do this without using a third-party compiler or add-on/tool?

도움이 되었습니까?

해결책

It's quite impossible. Even if you were to define every scrap of code as a template, they would still be compiled. Besides, why do you even have code in your codebase that you don't use? Just delete them and use source control to recover them. You're trying to solve a non-problem that doesn't have a solution.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top