Skip to content

Commit

Permalink
Add a test for foreign_archive of cxx files
Browse files Browse the repository at this point in the history
  • Loading branch information
recoules committed Aug 5, 2021
1 parent 0e534f8 commit d6f2d9b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/blackbox-tests/test-cases/foreign_cxx_library.t/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(executable
(name main)
(modes byte)
(libraries hello_world))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 2.9)
9 changes: 9 additions & 0 deletions test/blackbox-tests/test-cases/foreign_cxx_library.t/lib/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(library
(name hello_world)
(foreign_archives hello_world)
(c_library_flags -lstdc++))

(foreign_library
(archive_name hello_world)
(language cxx)
(names hello_world))
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>

extern "C" void hello_world ();

void hello_world ()
{
std::cout << "Hello World!";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
external hello_world : unit -> unit = "hello_world"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello_world.hello_world ();;
2 changes: 2 additions & 0 deletions test/blackbox-tests/test-cases/foreign_cxx_library.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Building a cxx library should run ocamlmklib with "-lstdc++".
$ dune build --verbose 2>&1 | grep -e "ocamlmklib" | grep -qe "-lstdc++"

0 comments on commit d6f2d9b

Please sign in to comment.