h12w / cwrap Goto Github PK
View Code? Open in Web Editor NEWWraps C libraries in Go.
License: BSD 2-Clause "Simplified" License
Wraps C libraries in Go.
License: BSD 2-Clause "Simplified" License
Hello -- firstly, thank you for your work here. I'm excited to use this package.
I'm attempting to use this project to create bindings for MuPDF's Fitz. I'm using your MuPDF example as a reference, but my code is not working. Any advice would be greatly appreciated.
Here's my directory setup. I effectively cloned MuPDF and plucked out the include/
directory:
./
| main.go
| include/
| | mupdf/
| | | fitz.h
| | | memento.h
| | | pdf.h
| | | ucdn.h
| | | fitz/
| | | | lots of fitz headers...
| | | helpers
| | | | helpers...
| | | pdf/
| | | | pdf headers...
My go code:
package main
import (
. "h12.io/cwrap"
"fmt"
)
const (
Ldflags = "LDFLAGS: /usr/local/lib/libmupdf.a /usr/local/lib/libmupdf-js-none.a -lm -lfreetype -ljpeg -lopenjp2 -ljbig2dec -lssl -lcrypto"
)
var (
fitz = &Package{
PacName: "fitz",
PacPath: "go-fitz/",
From: Header{
Dir: "include/",
File: "mupdf/fitz.h",
NamePattern: `(?i:\Afz(.*))`,
Excluded: []string{
"fz_get_annot_type",
"fz_open_file_w",
},
CgoDirectives: []string{Ldflags},
},
Included: []*Package{},
}
)
func main() {
err := fitz.Wrap()
if err != nil {
fmt.Println(err)
}
}
And, the errors I'm getting. I'm at a complete loss for how to solve the first error about the "angled include." The second one is about relative imports, and I'm able to make it go away by flattening all of the fitz code into one directory. But, I don't think that's the right way to solve the issue:
./_cwrap-2668373447.h:2:10: error: 'mupdf/fitz.h' file not found with <angled> include; use "quotes" instead
#include <mupdf/fitz.h>
^~~~~~~~~~~~~~
"mupdf/fitz.h"
In file included from ./_cwrap-2668373447.h:2:
./mupdf/fitz.h:30:10: fatal error: 'mupdf/fitz/version.h' file not found
#include "mupdf/fitz/version.h"
^~~~~~~~~~~~~~~~~~~~~~
exit status 1
Thank you in advance for your help!
func Spearman(data1 []float64, stride1 int, data2 []float64, stride2 int, n int) (work float64, ret float64) {
_work := (*C.double)(unsafe.Pointer(&work))
_ret := C.gsl_stats_spearman(_data1, _stride1, _data2, _stride2, _n, _work)
ret = float64(_ret)
return
}
From the documentation of gsl Spearman (https://www.gnu.org/software/gsl/manual/html_node/Correlation.html) the function definition is:
double gsl_stats_spearman (const double data1[], const size_t stride1, const double data2[], const size_t stride2, const size_t n, double work[])
Additional workspace of size 2*n is required in work. What is the best thing to do here. Do I manually modify the wrapper so that I can pass in the correct size of []float in "work"?
See corresponding golang nuts thread:
https://groups.google.com/forum/#!topic/golang-nuts/vNUqbdP1tpQ
Tried to run it on gmime library and got this:
/usr/local/include/gmime-2.6/gmime/gmime.h:26:33: error: gmime/gmime-version.h: No such file or directory
I guess some settings are wrong, but which ones?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.