global static pointer variable in DLL

Zarathustra adam.chrapkowski at gmail.com
Sun May 25 20:32:40 PDT 2008


Koroskin Denis Wrote:

> On Sun, 25 May 2008 22:57:35 +0400, Zarathustra  
> <adam.chrapkowski at gmail.com> wrote:
> 
> > Ok I resolved this problem by change std.c.stdlib.malloc on  
> > std.gc.malloc.
> > But now I still have a problem with fprintf() functions.
> > code:
> > ________________________________________________________
> > offs = fprintf(gl2ps.stream,
> >                  "1 0 obj\n<<\n/Title (%s)\n/Creator (GL2PS %d.%d.%d%s,  
> > %s)\n/Producer (%s)\n",
> >                  gl2ps.title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION,
> >                  GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION,  
> > GL2PS_COPYRIGHT,
> >                  gl2ps.producer);
> > ________________________________________________________
> > Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at _strlen  
> > (0x0042a37d) thread(3380)
> >
> > but when I change it:
> > code
> > ________________________________________________________
> >   offs = fprintf(gl2ps.stream,
> >                  /*"1 0 obj\n<<\n/Title (%s)\n/Creator (GL2PS  
> > %d.%d.%d%s, %s)\n/Producer (%s)\n",*/
> >                  gl2ps.title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION,
> >                  GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION,  
> > GL2PS_COPYRIGHT,
> >                  gl2ps.producer);
> > ________________________________________________________
> > everything is ok :/, too long string or what?
> 
> Looks like you provide a null-pointer as a string to fprintf...

Why Do you think that? When I shorten string then error don't occur. There didn't occur null pointers, I checked It before.
I think that interesting is the error "_strlen". Also interesting is that, why when I execute this code with C then everything is ok. How to check what does this error exactly mean? It looks like rate of data is too big for one fprintf() call.


More information about the Digitalmars-d-learn mailing list