-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add idiomatic C++ functions in bezier
namespace
#131
Labels
Comments
dhermes
changed the title
Use "namespace
Use C++ namespace and Oct 11, 2018
BEZ_
prefix for exported C ABI names
UPDATE: The below is outdated, the main issue description now references this core idea (after #166 was completed). From a StackOverflow answer: namespace bezier {
extern "C" {
void cross_product(double* vec0, double* vec1, double* result);
...
}
} is possible, though if we want the C / ABI extern "C" {
void BEZ_cross_product(double* vec0, double* vec1, double* result);
...
}
namespace bezier {
void cross_product(double* vec0, double* vec1, double* result) {
BEZ_cross_product(double* vec0, double* vec1, double* result);
}
...
} cc @pazner |
dhermes
changed the title
Use C++ namespace and
Use Jan 10, 2020
BEZ_
prefix for exported C ABI namesbezier
namespace for C++ parts of header files
Did some Googling and found a few things:
|
I was curious about the overhead of the bezier::cross_product(std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&):
sub rsp, 24
mov rsi, QWORD PTR [rsi]
mov rdi, QWORD PTR [rdi]
lea rdx, [rsp+8]
call BEZ_cross_product
movsd xmm0, QWORD PTR [rsp+8]
add rsp, 24
ret |
dhermes
changed the title
Use
Add idiomatic C++ functions in Jun 7, 2021
bezier
namespace for C++ parts of header filesbezier
namespace
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example,
helpers.h
would becomeMy biggest concern is about the level of effort needed to make an idiomatic C++ interface (e.g. using
vector<double>
instead ofdouble*
) and using RAII.FWIW I'm not 100% sure how I'll get the C++ name mangling to work right with the symbols exported by Fortran.See also: #166.
The text was updated successfully, but these errors were encountered: