Custom language compiler

Hey, I’m trying to make my own compiler and ran into a few issues.

I know how to get the lexer and parser to work, however:

How can my compiler use third-party APIs/libraries, things like “windows.h” or SFML or anything alike (the examples I’ve given are coded in c++, but they wouldn’t necessarily be in that language).

I’m not sure at what level I should even try to use these libraries -am I supposed to call the .dll file they provide myself, with machine code? And if so, how would I do that? If not, what else has to be done?

Thanks.