Cython is a static compiler that accepts a superset
of Python allowing a programmer to mix C/C++
declarations and definitions in Python-like code
which is then translated to C for efficient
implementation. In particular, programmers can write
modules that can be imported and called from Python,
in a manner analogous to pybind11. Our general ML
design rules can be applied to this usage of Cython as
follows:
C1. The python component imports the Cython
generated module (created by the build file) by
name, in standard python syntax.
C2. The binding file (~.pyx) should be named the
same as the binding module name in the build
file (~setup.py).
C3. The binding file should include a header file
containing declarations of the C functions used
in the binding functions in (~.pyx).
7 CONCLUSIONS
Large software systems often have components
written in different languages. The FFI approach to
cross-language interoperability is popular and
relatively easy to use, mimicking as it does a host
language function call. Our approach is to accept that
programmers will continue to use existing and new
FFI interfaces, and we do not try to present a new
multilingual interface concept or formalism. Instead,
we have developed a lightweight toolkit, MLSA
(Lyons, Bogar and Baird 2018) for analysing such
multilingual systems and identifying software
engineering and security issues. In particular, given
the nature of the FFI, we have focused on call-graph
analysis (Bogar, Lyons and Baird 2018). In this paper,
we have addressed the problem that there is little in
the way of design assistance for FFI based
multilingual software, comparable to the Lakosian
design method of (Lakos 1996) for C++.
We have proposed an extended application of
the Lakosian design method to multilingual software.
In particular, we applied this to software written using
the popular pybind11 FFI to call C++ from Python.
We reported on our study of 50 public GitHub
pybind11 repositories: While 16% already adhered to
our guidelines, 84% did not. Of the non-compliant
cases, binding file naming and use of lambda
functions are the most often issues. Based on our
experience with pybind11, we proposed a more
general set of multilingual design rules. In future
work, we plan to evaluate these rules against other
FFI. Finally, we believe we have just begun the task
of understanding how Lakosian physical design rules
hold value for the design of multilingual software.
ACKNOWLEDGEMENTS
Lyons and Zahra are partially supported by grant DL-
47359-15016 from Bloomberg L.P.
REFERENCES
Abrahams, D., and R.W. Grosse-Kunstleve. 2003. Building
Hybrid Systems with Boost.Python. 14 5.
https://www.boost.org/doc/libs/1_69_0/libs/python/do
c/html/article.html.
Ali, K., and Ondrej Lhotak. 2012. “Application-only Call
Graph Construction.” ECOOP'12 Proceedings of the
26th European Conf. on Object-Oriented Prog..
Beijing.
Bacon, D., and P. Sweeney. 1996. “Fast static analysis of
C++ virtual function calls.” 11th ACM SIGPLAN Conf.
on OO Prog. Sys., Lang & App.
Barrett, D., A. Kaplan, and J. Wileden. 1996. “Automated
support for seamless interoperability in polylingual
software systems.” 4th ACM SIGSOFT symposium on
Foundations of software engineering. New York.
Bogar, A.M., D. Lyons, and D. Baird. 2018. “Lightweight
Call-Graph Construction for Multilingual Software
Analysis.” 13th Int. Conf. Soft. Tech.. Porto, Portugal.
Bravenboer, M., E. Dolstra, and E. Visser. 2010.
“Preventing injection attacks with syntax embeddings.”
Sci. Comput. Program. 75 (7): 473-495.
Bronevetsky, G. 2009. “Communication-Sensitive Static
Dataflow for Parallel Message Passing Applications.”
International Symposium on Code Generation and
Optimization. Seattle WA.
Grechanik, M., D. Batory, and D. Perry. 2004. “Design of
large-scale polylingual systems.” 26th Int. Conf. on
Software Systems. Edinburgh UK.
Grimmer, M., R. Schatz, C. Seaton, T. Wurthinger, and M.
Lujan. 2018. “Cross-Language Interoperability in a
Multi-Language Runtime.” ACM Trans. on Prog.
Languages and Systems (ACM) 40 (2): 8:1-8:43.
Hong, S., and et al. 2015. “Mutation-Based Fault
Localization for Real-World Multilingual Programs.”
30th IEEE/ACM Int. Conf. on Automated Software Eng.
Lakos, John. 1996. Large-Scale C++ Software Design.
Addison-Wesley..
Lee, S., J. Doby, and S. Ryu. 2016. “HybriDroid: static
analysis framework for Android hybrid applications.”
31st IEEE/ACM International Conference on
Automated Software Engineering. Singapore.
Lyons, D., A. Bogar, and D. Baird. 2017. “Lightweight
Multilingual Software Analysis.” 12th Int. Conf. on
Software Technologies (ICSoft). Madrid, Spain.
Lyons, D., A.M. Bogar, and D. Baird. 2018. “Lightweight
Multilingual Software Analysis.” In Chall. & Opp. in
ICT Research Projects, by J. Filipe. SCITEPRESS.
Mayer, P., M. Kirsch, and M-A. Le. 2017. “On multi-
language software development, cross-language links
and accompanying tools: a survey of professional