Horde3D http://horde3d.org/forums/ |
|
Horde and Go http://horde3d.org/forums/viewtopic.php?f=1&t=1636 |
Page 1 of 1 |
Author: | tshannon [ 09.02.2012, 00:53 ] |
Post subject: | Horde and Go |
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. |
Author: | DarkAngel [ 09.02.2012, 01:16 ] |
Post subject: | Re: Horde and Go |
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 With this:{ enum List { ... /*and*/ DLL float h3dGetOption( H3DOptions::List param ); Code: enum H3DOptionsList
{ ... /*and*/ DLL float h3dGetOption( H3DOptionsList param ); |
Author: | tshannon [ 09.02.2012, 18:47 ] |
Post subject: | Re: Horde and Go |
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? |
Author: | tshannon [ 11.02.2012, 16:29 ] |
Post subject: | Re: Horde and Go |
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. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |