www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.internals - including "globals.h" in "mscoffobj.c"

reply Benjamin Thaut <code benjamin-thaut.de> writes:
Currently when compiling dmd it seems to be setup so that 
"globals.h" can not be included from "mscoffobj.c". I'm wondering 
now if this is intentional. If it is intentional how would one 
access certain flags which are part of the globals.params struct 
inside mscoffobj.c?

I can think of two ways right now
1) Add additional arguments to MsCoffObj::init
2) Pull out the condition into the dmd frontend (this would be a 
lot of boilerplate code to add in this case)

In case details are needed look at this file and search for 
"global.params": 
https://github.com/Ingrater/dmd/blob/DllSupportD2/src/backend/mscoffobj.c

Kind Regards
Benjamin Thaut
Jul 16 2017
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 7/16/2017 10:56 AM, Benjamin Thaut wrote:
 Currently when compiling dmd it seems to be setup so that "globals.h" can not
be 
 included from "mscoffobj.c". I'm wondering now if this is intentional. If it
is 
 intentional how would one access certain flags which are part of the 
 globals.params struct inside mscoffobj.c?
 
 I can think of two ways right now
 1) Add additional arguments to MsCoffObj::init
 2) Pull out the condition into the dmd frontend (this would be a lot of 
 boilerplate code to add in this case)
 
 In case details are needed look at this file and search for "global.params": 
 https://github.com/Ingrater/dmd/blob/DllSupportD2/src/backend/mscoffobj.c
This is intentional because global.params is part of the front end, and mscoffobj.c is part of the back end. I try to not tangle them up together. See backconfig.c on how information is transmitted by the front end to the back end.
Jul 16 2017
parent Benjamin Thaut <code benjamin-thaut.de> writes:
On Sunday, 16 July 2017 at 21:11:20 UTC, Walter Bright wrote:
 This is intentional because global.params is part of the front 
 end, and mscoffobj.c is part of the back end. I try to not 
 tangle them up together.

 See backconfig.c on how information is transmitted by the front 
 end to the back end.
Thank you, I will take a look at backconfig.c and mimic the way information is passed through there for my use case.
Jul 17 2017