I am building a dll with Dev-C++ 4.9.9.2 and my shared data segment is not being recognized.
I have tried to use code MY_SEG READ WRITE SHARED[/code] in a .def file and pointed the linker at it and still not working.
I look into the file created by dlltool and only my exports are listed.
I have variables in my dll that MUST remain static for all instances used.
If you have .def file sample for for this compiler, please post it here.
Or if there is another way, i would like to also see it.
I prefer to use .def files because if i add new services to the dll, older client apps can still import functions without having to be rebuilt.
Ok, thanks for your time, and any response will be greatly appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
and #pragma directive is by definition compiler specific, that is what #pragma is for. In general GCC doesn't not support many #pragma directives ( see http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Pragmas.html#Pragmas ). Moreover teh required behaviour of a conforming compiler with respect to an unsupported #pragma is to ignore it, so you may never know when it is not doing its job!
In GCC to specify the segment location of a variable you must use the data attribute extension. For example:
I have no idea. I simply gave you what I believe is the direct equivalent of Microsoft's #pragma data_seg directive, that's the extent of my knowledge on this. Sorry.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am building a dll with Dev-C++ 4.9.9.2 and my shared data segment is not being recognized.
I have tried to use code MY_SEG READ WRITE SHARED[/code] in a .def file and pointed the linker at it and still not working.
I look into the file created by dlltool and only my exports are listed.
I have variables in my dll that MUST remain static for all instances used.
If you have .def file sample for for this compiler, please post it here.
Or if there is another way, i would like to also see it.
I prefer to use .def files because if i add new services to the dll, older client apps can still import functions without having to be rebuilt.
Ok, thanks for your time, and any response will be greatly appreciated.
//includes here
//global vars here
//pragma statement here
pragma data_seg("MY_SEG")//begin shared data segment
//what is shared here
pragma data_seg() //end shared data segment
pragma comment(linker, "/SECTION:MY_SEG,RWS")//tells linker to generate the shared data segment.
//dll code here
Uh....
As I said the required behaviour of a conforming compiler with respect to an unsupported #pragma is to ignore it. GCC will ignore that. http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Pragmas.html#Pragmas
and #pragma directive is by definition compiler specific, that is what #pragma is for. In general GCC doesn't not support many #pragma directives ( see http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Pragmas.html#Pragmas ). Moreover teh required behaviour of a conforming compiler with respect to an unsupported #pragma is to ignore it, so you may never know when it is not doing its job!
In GCC to specify the segment location of a variable you must use the data attribute extension. For example:
int MyData attribute ((section ("MY_SEG"))) = 0;
See http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Variable-Attributes.html#Variable-Attributes for details.
Clifford
So after using the attributes variable descriptor i will still need to point the linker at my .def file, right???
In my .def file...
SECTIONS
MY_SEG READ WRITE SHARED
EXPORTS
DoSomething @1
DoSomethingElse @2
In the linker commands box...
-def mydef.def
Am i on the right track???
I have no idea. I simply gave you what I believe is the direct equivalent of Microsoft's #pragma data_seg directive, that's the extent of my knowledge on this. Sorry.