global static pointer variable in DLL

torhu no at spam.invalid
Sat May 17 10:15:16 PDT 2008


Zarathustra wrote:
> I have a C DLL whih global static pointer variables.
> When I use this DLL with C everything is ok, but when I try to use it (DLL) with D I receive Acces Violation errors.
> I do not have any idea what is wrong. If something is inexplicable, You will ask. Please help.
> 
> simple example code in dll
> gl2ps is global pointer
> [code]
> if(gl2ps){/* 
> never true in C but true in D*/}
> [/code]
> 

It's a bit hard to know what the problem is when you don't post some 
more code.  How do you declare gl2ps in D?  If it's in a C DLL, it 
should look like this:

export extern extern (C) void* gl2ps;

Replace void* with the correct type, of course.

And in the C code IIRC it should be:

__declspec(dllexport) void* gl2ps;


More information about the Digitalmars-d-learn mailing list