I am fighting a week with this and right now I don't see it working fully
automatically. It needs manual work which is OK because it can be automated
with
.bash script. I need it working until you figure out how to work
automatically.
There are a lot of details ad I doubt to can be automated 100%. This does
not
matter - I need it working.
I followed your recommendation for restructuring the code and I understand
better how go commands process is working. But still there some
missing steps to finish my task.
SWIG option for integer size prevents automatic code generation
using .swigxxx. I circumvented this by calling SWIG directly:
swig -v -Wall -go -intgosize 64 -gccgo -c++ geoconvert.i
This gives me:
1) geoconvert_wrap.cxx
2) geoconvert.go
if 1) is compiled directly returns errors - it need to be modified:
# edit geoconvert_wrap.cxx -> leave only:
#void SwigDoCgocall(void) __asm__("syscall.Cgocall");
#void SwigDoCgocallDone(void) __asm__("syscall.CgocallDone");
#void SwigDoCgocallBack(void) __asm__("syscall.CgocallBack");
#void SwigDoCgocallBackDone(void) __asm__("syscall.CgocallBackDone");
So it cannot be automated 100% because of SWIG code generation issue. Again
does not matter if I get the job done - it is one time task only
Then I compile all those C/C++ code:
g++ -c -g -O3 geoconvert.cpp -o geoconvert_impl.o # ==> geoconvert_impl.o
g++ -c -g -O3 geoconvert_wrap.cxx -o geoconvert_wrap.o # ==>
geoconvert_wrap.o
geoconvert.cpp is an interface I need to the library I am using.
then:
gccgo -c geoconvert.go -o geoconvert.o # ==> geoconvert.o
Now I have:
geoconvert.o
geoconvert_wrap.o
geoconvert_impl.o
Also I need two external libraries:
libGeographic.a
libstdc++.a
In order to have them in one place I combined them with archive:
ar cr *geoconvert.a* geoconvert.o geoconvert_wrap.o geoconvert_impl.o /usr
/local/lib/libGeographic.a /usr/lib/gcc/x86_64-linux-gnu/4.7.2/libstdc++.a
*geoconvert.a* is my final package as static library.
I suppose I have to copy it here manually:
/home/parallels/mygo/pkg/linux_amd64/*myproject*
*
*
*In order to call it from:*
*/* example.go */*
*import* (
"fmt"
"*myproject*/*geoconvert*"
)
Will this work?
--Constantine
ar cr geoconvert.a geoconvert.o geoconvert_wrap.o geoconvert_impl.o /usr
/local/lib/libGeographic.a /usr/lib/gcc/x86_64-linux-gnu/4.7.2/libstdc++.a
On Tuesday, January 29, 2013 9:09:17 PM UTC-8, Ian Lance Taylor wrote:On Tue, Jan 29, 2013 at 8:32 PM, Constantine Vasil wrote:
got these files:
geoconvert_impl.o
geoconvert.o
geoconvert_wrap.o
how to link them and install them as a package?
e.g. how to use this command, I have three object files:
go install -gccgoflags '-v' -compiler=gccgo myproject/mypackage
The idea is that the go command should handle the details of creating
and using the package for you.
Ian
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.