Konstantina Panagiotopoulou <kwno...@hotmail.com> wrote on 03/15/2014
06:44:13 PM:
>
> I have started reading on the Complex and Double bindings you
> pointed in your previous email.
> I am still trying to get around the wrapping procedure.
>
> I want to ask how to compile these files.
>
> I ll probably need g++, but what args am I passing?
> Also, shall I place them in the same directories as Complex and Double?
> Finally,since GMP is also ported to C++ from C, I need to pass these
> two library flags
> " --lgmpxx -lgmp" and (if it was for C++ code) #include
> <gmpxx.h>. Is this possible?
>
Hi,
You have two possible approaches.
Build it in to the core X10 standard library: For the truly core
classes like Complex and Double, we have native files that are included in
the X10 standard C++ library (x10.runtime/src-cpp/x10/lang/ComplexNatives*
and DoubleNatives*). Add the link/include flags to
x10.runtime/src-cpp/Make.rules. This is probably the quickest way to do
it, but requires you to build X10 from source and is probably harder to
eventually contribute back.
Build it more as a user-level library without rebuilding X10: This
approach would be easier to contribute back, since it doesn't add a
dependency on GMP. To make it work, you use a set of annotations
(@NativeCPPInclude, @NativeCPPCompilationUnit) and additional command line
arguments to x10c++.
@NativeCPPInclude("foo.h") is used to add a #include "foo.h" to the
top of the C++ file generated from the X10 file.
@NativeCPPCompilationUnit("foo.cc") is used to add foo.cc to the
compilation/link command of g++ when the C++ file generated from the X10
file is compiled.
To add extra library flags, you invoke x10c++ with -cxx-postarg to
pass along extra arguments to g++. For example x10c++ MyFile.x10
-cxx-postarg -lgmpxx -cxx-postarg -lgmp
Hope this helps a little bit.
I think the way to start is to start small, experiment with the various
annotations and x10c++ arguments on a small file to see what they do, then
grow from there.
You may already know this, but a useful trick is:
x10c++ -report postcompile=5 <REST OF COMMAND>
This causes x10c++ to echo the exact command line it is using to invoke g+
+, which can help see what the various arguments are doing.
[dgrove@linchen myTests]$ x10c++ -report postcompile=5 HelloWholeWorld.x10
Output files: {HelloWholeWorld=[HelloWholeWorld.h, HelloWholeWorld.cc]}
Executing post-compiler g++ -I/home/dgrove/x10-trunk/x10.dist/include
-I/home/dgrove/x10-trunk/x10.dist/stdlib/include
-I/home/dgrove/x10-trunk/myTests -I. -Wno-long-long -Wno-unused-parameter
-DHOMOGENEOUS -DX10_USE_BDWGC -Wl,--no-as-needed -pthread
HelloWholeWorld.cc xxx_main_xxx.cc
-L/home/dgrove/x10-trunk/x10.dist/stdlib/lib -lx10 -lgc -lm -lpthread -lrt
-ldl -L/home/dgrove/x10-trunk/x10.dist/lib -lx10rt_sockets -Wl,--rpath
-Wl,/home/dgrove/x10-trunk/x10.dist/stdlib/lib -Wl,--rpath
-Wl,/home/dgrove/x10-trunk/x10.dist/lib -Wl,-export-dynamic
--dave
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users