B3DAccelerator on 64bits

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

B3DAccelerator on 64bits

Nicolas Cellier
 
Hi,
Compiler warnings on 64bits for B3DAccelerator Plugin makes me think it can't work:

clang-5.0: warning: argument unused during compilation: '-mdll' [-Wunused-command-line-argument]
../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:103:19: warning: implicit declaration of function 'getImageName' is invalid in C99 [-Wimplicit-function-declaration]
                strcpy(fileName,getImageName());
                                ^
../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:103:19: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                strcpy(fileName,getImageName());
                                ^~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:61:77: note: passing argument to parameter '_Source' here
  char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);

We are going to pass an address on 32bits because getImageName() has not been declared and will be considered as returning an int...
If the address were on low end of address space it could eventually work, but we can't depend on such property.

It's vital that we properly declare function prototypes (preferably by using ad hoc header) and all  [-Wimplicit-function-declaration] reports deserve greater attention.
Reply | Threaded
Open this post in threaded view
|

Re: B3DAccelerator on 64bits

Eliot Miranda-2
 
Hi Nicolas,

On Tue, Dec 11, 2018 at 1:38 AM Nicolas Cellier <[hidden email]> wrote:
 
Hi,
Compiler warnings on 64bits for B3DAccelerator Plugin makes me think it can't work:

clang-5.0: warning: argument unused during compilation: '-mdll' [-Wunused-command-line-argument]
../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:103:19: warning: implicit declaration of function 'getImageName' is invalid in C99 [-Wimplicit-function-declaration]
                strcpy(fileName,getImageName());
                                ^
../../platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:103:19: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                strcpy(fileName,getImageName());
                                ^~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:61:77: note: passing argument to parameter '_Source' here
  char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);

We are going to pass an address on 32bits because getImageName() has not been declared and will be considered as returning an int...
If the address were on low end of address space it could eventually work, but we can't depend on such property.

Agreed.  Ugh; this is ugly code (and if I'm responsible I apologize).  What it's trying to do is find the image file's directory and write the Squeak3D.log file there-in.  I think there are a few other places that do this.  So instead of replicating this ugly code (that won't work on Windows) we should be using e.g. something called getImageFileDirectory, which may have to be written.  I'll try and look at this soon.  Maybe raise an issue on open smalltalk-vm?


It's vital that we properly declare function prototypes (preferably by using ad hoc header) and all  [-Wimplicit-function-declaration] reports deserve greater attention.


--
_,,,^..^,,,_
best, Eliot