Sign in to follow this  
Eddycharly

simple DevCpp question

Recommended Posts

Hi, i moved from vc to devcpp, and have a little problem to port one of my old projects. The problem is that this project uses a dll with a shared section in it. Under vc, it was as simple as adding a few pragmas to get the shared section working, like this : // variables shared across all instances of the dll #pragma data_seg("SHARED") #pragma comment (linker, "/SECTION:SHARED,RWS") HHOOK HookHandle = 0; int DllLoadCount = 0; char ExecutionPath[257] = ""; #pragma data_seg() Now, these pragmas don't seem to work with devcpp. The devcpp documentation i have is pretty poor. I also tried google, but it looks like i got a lot unrelated answers.. Would be nice if someone could point me in the right direction. Cheers, thanks.

Share this post


Link to post
Share on other sites
Dev-Cpp's documentation isn't so good because it's just an IDE, it uses the MinGW compiler, [google], I don't know much about DLLs, but couldn't you just use extern?

Share this post


Link to post
Share on other sites
i really don't like the gcc docs, quite hard to read.
also the word "shared" seems to apear everywhere in the options, that doesn't help to find a relevant answer..
thanks, i'm going to investigate in the mingw and gnu compilers docs.
i don't think i can use extern here, extern is to share data at compile time between compilation units. what i want is to have a data section shared by all the instances of the loaded dll at run time.

thanks a lot.

Share this post


Link to post
Share on other sites
Ok, i finally found it.
If anyone is interested, here is the devcpp version :

HHOOK __attribute__((section ("SHARED"), shared)) HookHandle = 0;
int __attribute__((section ("SHARED"), shared)) DllLoadCount = 0;
char __attribute__((section ("SHARED"), shared)) ExecutionPath[257] = "";

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this