mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-28 15:54:18 +00:00
Estimated hours taken: 0.25 Branches: main Fix a bug where the Mercury calls C++ sample was not linking with the C++ library. This worked, because the sample didn't actually make use of the C++ library, but failed as soon as users tried to extend the sample to use with their real C++ programs. samples/c_interface/mercury_calls_cplusplus/cpp_main.cc: Use the C++ standard library's stream I/O, rather than printf(). samples/c_interface/mercury_calls_cplusplus/Mmakefile: Make sure that we link with the C++ standard library. Also, comment out the old hack that worked around a g++ 2.7 bug which is fixed in g++ 2.95.
15 lines
264 B
C++
15 lines
264 B
C++
// This source file is hereby placed in the public domain. -fjh (the author).
|
|
|
|
#include <iostream>
|
|
|
|
#include "cpp_main.h"
|
|
|
|
// Use some C++ features
|
|
class Foo { };
|
|
|
|
void cpp_main(void) {
|
|
Foo *p = new Foo;
|
|
std::cout << "In cpp_main()." << std::endl;
|
|
delete p;
|
|
}
|