[x3d-public] C SAI on Linux

John Carlson yottzumm at gmail.com
Fri Aug 6 22:32:13 PDT 2021


Hello, C SAI developers!

The examples in SAIExample{2,4} are more along the lines of what I was 
looking for building an SAI app. I will take my VRMLScriptSerializer.js 
and start writing the CSerializer.js and CppSerializer.js. I do not 
currently have a way of using the C/C++ SAI library, since they appear 
to be .dll's, not .so's, but I've been provided enough to compile, it 
appears.  I may be able to do something with WINE or a virtual machine. 
Providing/Selling .so's or source code would be great.  I can create a 
minimal build environment on Linux.  Right now, I'm using gcc and clang 
on the command line (CLI) in a terminal emulator/Konsole on Linux. There 
should be some way of doing cross-compilation, but it's been a very long 
long time since I did cross-compilation. I don't know if linking will 
work is my issue.

It's great to be working with you!

Once I get the C API somewhat working, I will switch to C++.

Thanks,

John

I did not get past the first few patches.  Please assist.  My first set 
of differences is below.  If necessary, we can start providing 
#ifdef/#ifndef to compile.

$ svn diff .
Index: X3DLib/Abstracts.h
===================================================================
--- X3DLib/Abstracts.h  (revision 32348)
+++ X3DLib/Abstracts.h  (working copy)
@@ -1,11 +1,12 @@
  #ifndef _Abstracts_H_
  #define _Abstracts_H_

-#include <gl\gl.h>                     // OpenGL extensions
-#include <gl\glu.h>
-#include <math.h>
-#include <afxtempl.h>
-#include <stdint.h>
+#include <GL/gl.h>                     // OpenGL extensions
+#include <GL/glu.h>
+//#include <math.h>
+//#include <afxtempl.h>
+//#include <stdint.h>
+#include "glMath.h"

  class CX3DMetadataObject;
  class CX3DPrototypeInstance;
@@ -5553,4 +5554,4 @@
         CURLUnavailableException(CString);
  };

-#endif // _Abstracts_H_
\ No newline at end of file
+#endif // _Abstracts_H_
Index: X3DLib/X3DLib.h
===================================================================
--- X3DLib/X3DLib.h     (revision 32348)
+++ X3DLib/X3DLib.h     (working copy)
@@ -6,8 +6,8 @@
  #define _X3DLib_H_


-#include <gl\gl.h>                     // OpenGL extensions
-#include <gl\glu.h>
+#include <GL/gl.h>                     // OpenGL extensions
+#include <GL/glu.h>
  //#include <math.h>
  //#include <afxtempl.h>
  //#include <stdint.h>

=======================================================================================================================

Errors/warnings appear below.  Apparently, one can't overload functions 
in C.  Note also that class is not a keyword in C (once you fix these)


/X3DJSONLD/src/main/c/net/coderextreme/data$ gcc -I /usr/include abox.c
In file included from 
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/X3DLib.h:14,
                  from abox.c:1:
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:48:8: error: 
unknown type name ‘BOOL’
    48 | extern BOOL IsEven(int n);
       |        ^~~~
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:49:8: error: 
unknown type name ‘BOOL’
    49 | extern BOOL IsEven(float f);
       |        ^~~~
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:49:13: error: 
conflicting types for ‘IsEven’
    49 | extern BOOL IsEven(float f);
       |             ^~~~~~
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:48:13: note: 
previous declaration of ‘IsEven’ was here
    48 | extern BOOL IsEven(int n);
       |             ^~~~~~
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:60:14: error: 
conflicting types for ‘Roundf’
    60 | extern float Roundf(GLfloat x, int numDecimalPlaces);
       |              ^~~~~~
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:59:12: note: 
previous declaration of ‘Roundf’ was here
    59 | extern int Roundf(GLfloat x);
       |            ^~~~~~
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:64:8: error: 
unknown type name ‘BOOL’
    64 | extern BOOL VecEqualf(VECTORF a, VECTORF b);
       |        ^~~~
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/glMath.h:82:68: error: 
unknown type name ‘BOOL’; did you mean ‘GL_BOOL’?
    82 | extern void CalNormalf(VECTORF a, VECTORF b, VECTORF c, VECTORF 
n, BOOL bCCW=TRUE);
| ^~~~
| GL_BOOL
In file included from 
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/X3DLib.h:15,
                  from abox.c:1:
/c/x3d-code/www.web3d.org/x3d/languages/c/X3DLib/Abstracts.h:7:10: fatal 
error: afxtempl.h: No such file or directory
     7 | #include <afxtempl.h>
       |          ^~~~~~~~~~~~
compilation terminated.




More information about the x3d-public mailing list