Comments (2)
I'm not one of the linenoise developers (just a user), but the typical solution to this (that is, using C++-oblivious C libraries from C++) is to wrap the #include
in an extern "C"
. For example, you could write a c++ line-noise wrapper (hypothetically named "linenoise.hpp" as follows:
#ifndef LINENOISE_HPP_INCLUDED
#define LINENOISE_HPP_INCLUDED
extern "C" {
#include "linenoise.h"
}
#endif
Then, you'd include linenoise.hpp instead of linenoise.h everywhere. This will have the same effect as what you did, without requiring a change to the linenoise source.
This will even work if, in the future, an extern "C"
block is added to linenoise.h, as they are allowed to nest.
from linenoise.
This was fixed merging a PR. Thanks.
from linenoise.
Related Issues (20)
- Abstract away stdin/stdout constants
- Linefeed not accepted as newline HOT 2
- Observation related to '!' characters (!1, !2, !3 etc..) to re-enter the Nth command
- cursor wrong when hint string begin with "\n"
- linenoise() always returns -1 on UserLAnd
- Test with Windows 10 ENABLE_VIRTUAL_TERMINAL_PROCESSING HOT 1
- Behavior of C-w in redis-cli HOT 1
- character shift if prompt string is empty ("") HOT 1
- Auto-complete files HOT 6
- Unnecessary (and risky) usage of atexit()
- Linenoise does not work with IntelliJ debug console HOT 3
- Max line length not removed for non-interactive shells
- Cannot paste multiple lines into the example program. HOT 1
- How to install linenoise for "Konsole" terminal? HOT 1
- Compilation fails with clang version 16.0.4 and `-pedantic-errors`
- Way to Iterate Through History
- Not Deleting Properly
- Explicit Versioning for Enhanced Security Assessments
- Use of reserved identifiers for the include guard in `linenoise.h`: The behaviour is undefined.
- Unexpected format when using Table output HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linenoise.