Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Considering using ArangoDB GO driver #11

Closed
sandrokeil opened this issue Oct 25, 2017 · 8 comments
Closed

Considering using ArangoDB GO driver #11

sandrokeil opened this issue Oct 25, 2017 · 8 comments
Labels

Comments

@sandrokeil
Copy link
Owner

It looks like the ArangoDB GO driver is more mature than the c++ driver. So we can use them and call it from c++.

GO has different build modes, so maybe it's really easy to use. /cc @martin-schilling

@sandrokeil
Copy link
Owner Author

Looks like we have to create an own main package because of building the go driver leads to errors.

-buildmode=c-archive requires exactly one main package
-buildmode=c-shared requires exactly one main package

@sandrokeil
Copy link
Owner Author

Here is an example blog post how to build c-shared.

@sandrokeil
Copy link
Owner Author

@martin-schilling I've created a new branch golang which builds the c archive from go-velocypack. Now we have to find a way to call test() from the php-cpp main file. I guess there is some linker fun ;-)

We have to check what does this mean exactly

The only callable symbols will be those functions exported using a cgo //export comment

@sandrokeil
Copy link
Owner Author

@martin-schilling I've added a test case. Now it's your turn. ;-) We have the following issues:

g++: warning: go/arangodb.a: linker input file unused because linking not done
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/arangodb.so' - /usr/lib/php/20160303/arangodb.so: 
invalid ELF header in Unknown on line 0
PHP Fatal error:  Uncaught Error: Call to undefined function vpack() in /app/test.php:13
Stack trace:
#0 {main}
  thrown in /app/test.php on line 13

Fatal error: Uncaught Error: Call to undefined function vpack() in /app/test.php:13
Stack trace:
#0 {main}
  thrown in /app/test.php on line 13

@martin-schilling
Copy link
Collaborator

@sandrokeil The linking stuff should hopefully be fixed now. I think the next aim should be getting some database interaction going in a test case.

@sandrokeil
Copy link
Owner Author

@martin-schilling Thanks so much. I want to try the vpack example from the master branch first and maybe the go return value mapping. You can bring a new PR with the connection if you have time. 👍

@sandrokeil
Copy link
Owner Author

There is an important issue

The correct program should use a type defined in C, rather than in Go, because otherwise the external C programs have to manually define a C struct matching the Go struct, which is non-trivial and error-prone.

@sandrokeil
Copy link
Owner Author

We stick with C++.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants