Horde3D

Next-Generation Graphics Engine
It is currently 23.11.2024, 01:25

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Horde and Go
PostPosted: 09.02.2012, 00:53 
Offline

Joined: 19.01.2012, 21:01
Posts: 55
I'm trying to build bindings for Horde for Go (http://golang.org/). It looks like it should be fairly straightforward, as Horde's API is C, and you can call C code fairly easily from Go (http://golang.org/cmd/cgo/).

When trying to build my code, I'm getting these errors, which seem to point to something in the Go compiler not liking how Horde3D.h is written.

Code:
/usr/local/include/horde3d/Horde3D.h:127:7: error: nested redefinition of âenum Listâ
  3 /usr/local/include/horde3d/Horde3D.h:127:7: error: redeclaration of âenum Listâ
  4 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
  5 /usr/local/include/horde3d/Horde3D.h:161:7: error: nested redefinition of âenum Listâ
  6 /usr/local/include/horde3d/Horde3D.h:161:7: error: redeclaration of âenum Listâ
  7 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
  8 /usr/local/include/horde3d/Horde3D.h:216:7: error: nested redefinition of âenum Listâ
  9 /usr/local/include/horde3d/Horde3D.h:216:7: error: redeclaration of âenum Listâ
 10 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 11 /usr/local/include/horde3d/Horde3D.h:244:7: error: nested redefinition of âenum Listâ
 12 /usr/local/include/horde3d/Horde3D.h:244:7: error: redeclaration of âenum Listâ
 13 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 14 /usr/local/include/horde3d/Horde3D.h:265:7: error: nested redefinition of âenum Listâ
 15 /usr/local/include/horde3d/Horde3D.h:265:7: error: redeclaration of âenum Listâ
 16 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 17 /usr/local/include/horde3d/Horde3D.h:288:7: error: nested redefinition of âenum Listâ
 18 /usr/local/include/horde3d/Horde3D.h:288:7: error: redeclaration of âenum Listâ
 19 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 20 /usr/local/include/horde3d/Horde3D.h:317:7: error: nested redefinition of âenum Listâ
 21 /usr/local/include/horde3d/Horde3D.h:317:7: error: redeclaration of âenum Listâ
 22 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 23 /usr/local/include/horde3d/Horde3D.h:320:3: error: redeclaration of enumerator âSamplerElemâ
 24 /usr/local/include/horde3d/Horde3D.h:291:3: note: previous definition of âSamplerElemâ was here
 25 /usr/local/include/horde3d/Horde3D.h:321:3: error: redeclaration of enumerator âUniformElemâ
 26 /usr/local/include/horde3d/Horde3D.h:292:3: note: previous definition of âUniformElemâ was here
 27 /usr/local/include/horde3d/Horde3D.h:323:3: error: redeclaration of enumerator âSampNameStrâ
 28 /usr/local/include/horde3d/Horde3D.h:296:3: note: previous definition of âSampNameStrâ was here
 29 /usr/local/include/horde3d/Horde3D.h:324:3: error: redeclaration of enumerator âUnifNameStrâ
 30 /usr/local/include/horde3d/Horde3D.h:298:3: note: previous definition of âUnifNameStrâ was here
 31 /usr/local/include/horde3d/Horde3D.h:349:7: error: nested redefinition of âenum Listâ
 32 /usr/local/include/horde3d/Horde3D.h:349:7: error: redeclaration of âenum Listâ
 33 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 34 /usr/local/include/horde3d/Horde3D.h:380:7: error: nested redefinition of âenum Listâ
 35 /usr/local/include/horde3d/Horde3D.h:380:7: error: redeclaration of âenum Listâ
 36 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 37 /usr/local/include/horde3d/Horde3D.h:408:7: error: nested redefinition of âenum Listâ
 38 /usr/local/include/horde3d/Horde3D.h:408:7: error: redeclaration of âenum Listâ
 39 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 40 /usr/local/include/horde3d/Horde3D.h:431:7: error: nested redefinition of âenum Listâ
 41 /usr/local/include/horde3d/Horde3D.h:431:7: error: redeclaration of âenum Listâ
 42 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
 43 /usr/local/include/horde3d/Horde3D.h:433:3: error: redeclaration of enumerator âUndefinedâ
 44 /usr/local/include/horde3d/Horde3D.h:163:3: note: previous definition of âUndefinedâ was here
 45 /usr/local/include/horde3d/Horde3D.h:455:7: error: nested redefinition of âenum Listâ
 46 /usr/local/include/horde3d/Horde3D.h:455:7: error: redeclaration of âenum Listâ


It doesn't seem to like the multiple nested enum definition of List. Am I missing something obvious to you guys?

Here's how I have the initial go declaration:

Code:
   
package horde3d
 
   /*
   #cgo LDFLAGS: -llibHorde3D
   #include <horde3d/Horde3D.h>
   */
   import "C"
 
   /*
  func H3dInit() bool {
          return bool(C.h3dInit())
  }
  */


Basically anything in that first comment can be valid C code, so as long as the header file is valid C, it should compile fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: Horde and Go
PostPosted: 09.02.2012, 01:16 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
I'm not sure if there's a better option, but in theory you can modify Horde3D.h yourself to remove the nested enums, e.g. replace this:
Code:
struct H3DOptions
{
        enum List
        {
         ...
/*and*/
DLL float h3dGetOption( H3DOptions::List param );
With this:
Code:
enum H3DOptionsList
{
 ...
/*and*/
DLL float h3dGetOption( H3DOptionsList param );


Top
 Profile  
Reply with quote  
 Post subject: Re: Horde and Go
PostPosted: 09.02.2012, 18:47 
Offline

Joined: 19.01.2012, 21:01
Posts: 55
I suppose I could, but ideally you'd be able to just make and install the standard SDK.

I'm wondering if the Horde3D.h file isn't C code but C++. Do I have the right header file? Is there a separate one for language bindings that only work with C?

For instances how do the lua and python bindings work?


Last edited by tshannon on 11.02.2012, 17:53, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Horde and Go
PostPosted: 11.02.2012, 16:29 
Offline

Joined: 19.01.2012, 21:01
Posts: 55
yeah, it looks like the Horde header while C compatible, is not actually C code, so I'm going to have to write a C code only header.

I haven't touched C code in about a decade, so this could be interesting. There shouldn't be any issues with using a C header with the C++ library right? I'm going to have to change all of the bools to ints and fix the enums, but I think it should work.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group