Pregunta

I have some macros like,
#define dosomething(x) something(x) and it is compiled into a dll. Will I have that macro in that lib created by the build?

¿Fue útil?

Solución

No.

Macros aren't even visible to the compiler. They get replaced by their substitution text during preprocessing, which happens at the very beginning. Macros are dumb, they know nothing about you or your motives. They don't even know what language you're writing. Beware!

Otros consejos

No.

Macros are just a (not so) elaborated copy pasting device at the source code level. They are expanded before compilation, and the compiler isn't aware of their existence.

If you want the dosomething symbol to be exported in your library, you have to declare it as a function.

Macros are used and processed by pre-processor only. They aren't used by compiler and not at all known by the linker. So, the answer is NO. Macros are not exported.

What do you need? Can't you just #include given header file?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top