Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

If XFLAT can share global variables between modules then how standard shared variables like errno, stderr, optarg, etc. handled by XFLAT?

0
10 Posted

If XFLAT can share global variables between modules then how standard shared variables like errno, stderr, optarg, etc. handled by XFLAT?

0
10

As described above and elsewhere, the global variables cannot be shared between your program code and shared libraries. Instead, the xflat-gcc tool inserts calls to data accessor functions to manage access to global variables across such module boundaries: When you reference such a global variable, you don’t actually reference the variable, you actually call a function that returns a pointer to the variable that gets dereferenced to access the variable. See the discussion below for more detail.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123