Comments (8)
I cannot replicate it anymore but I do not know why the binding code for that someFunction
is not generated.
from binder.
hm... i can not replicate this locally (see code that i used below) - bindings seems to be generated for someFunction
for that example and have corrected argument types. Could it be that your production code pickup overload for someFunction
that used int
as an argument?
struct B { // Virtual Base class
virtual void f()=0;
};
struct A {
void someFunction(const char* s, std::vector<B*> bs) {}
};
P.S: for future bug reports could you please post actual code that that is compellable? Thanks,
from binder.
Thanks. Can you share what do I need to bind your example? I guess I am missing something
from binder.
I think the easiest way to create bindings for isolated piece of code would be replicate steps in Binder testing script (see https://github.com/RosettaCommons/binder/blob/master/test/self-test.py) or just add custom test into https://github.com/RosettaCommons/binder/tree/master/test and re-run the test suite with your new test file as an argument.
from binder.
from binder.
Sorry. I noticed that and deleted my previous message.
I have a problem regarding this. As I said before I am writing a C++ API and make python bindings for it. My Public header file is like this:
// file: "api.h"
#pragma once
#include <stdint.h>
#include <cstddef>
#include <string>
#include <vector>
namespace ApiNameSpace
{
struct Base0
{
virtual ~Base0();
virtual Base0* copy() const = 0;
};
struct Base1 : public Base0
{
enum enumType
{
t1, t2, t3, t4
};
double v;
enumType e;
};
class builder
{
public:
builder();
int nonVectorFunction (const char* ch, int a);
int someFunction1(const char* ch, std::vector<Base1*> bs);
};
}
And I am making binding code for this file and link it with the required libraries when compiling the binding codes. You can try to make binding for the above file.
In this case, the binder does not make someFunction1
code for me. If I change the definition to
int someFunction1(const char* ch, std::vector<Base1*> bs) {};
(with curly brackets at the end - empty implementation) It does generate the binding.
Note that nonVectorFunction
is always being generated.
Do you have any Idea how can I overcome this issue??
With empty {}
, the bind_std_stl_vector
is generated, but without {}
, it does not. How can I force the generation of bind_std_stl_vector
??
Thanks
from binder.
I made some progress. If I change to the following I get the binding code
// file: "api.h"
#pragma once
#include <stdint.h>
#include <cstddef>
#include <string>
#include <vector>
namespace ApiNameSpace
{
struct Base0
{
virtual ~Base0();
virtual Base0* copy() const = 0;
};
struct Base1 : public Base0
{
enum enumType
{
t1, t2, t3, t4
};
double v;
enumType e;
};
}; // end of namespace
// add the instantiation of the vector
template class std::vector<ApiNameSpace::Base1*>;
namespace ApiNameSpace{
class builder
{
public:
builder();
int nonVectorFunction (const char* ch, int a);
int someFunction1(const char* ch, std::vector<Base1*> bs);
};
};
But when I compile with the pybind11 (not the one coming with binder from build.py) I get the following error
error: static assertion failed: Holder classes are only supported for custom types
static_assert(std::is_base_of<base, type_caster<type>>::value,
Any hints?
from binder.
RE absence of bindings for someFunction1
: this is expected behavior: Binder can only bind functions that have fully defined argument types. So for case of template arguments this mean that there have to be point of instantiation. And adding line like template class std::vector<ApiNameSpace::Base1*>;
(as you did above) is one way to trigger template instantiation.
RE compiling with different version of Pybind11: upgrading to use newer version of Pybind11 usually take considerable efforts so that's why i provide separate version of Pybind11 that known to be compatible with current version of Binder. From your log it looks like upgraded version of Pybind11 broke something, my guess is that template code for handling custom return policy might need to be updated but it is only a guess so i can not say anything definitive without investigating this further.
from binder.
Related Issues (20)
- ImportError when importing two different packages generated with binder that share an overlap HOT 8
- Release? HOT 6
- [question] customization of a trampoline function definition HOT 5
- Unclear usage of `add_on_binder` HOT 14
- Is there a way to exclude an enum? HOT 2
- Non-portable generated code for `size_t` HOT 18
- Build script tries to use pybind11 commit that isn't on a branch (anymore?) HOT 1
- Modify reference to primitive type HOT 2
- Method parameter reference to primitive type not working HOT 1
- Support for pybind11 smart_holder HOT 5
- LLVM >= 16.0.6 no longer builds with --std=c++14 HOT 4
- build-and-run-tests.py: Missing positional argument in call to install_llvm_tool HOT 1
- bind.py: upgrade llvm version HOT 3
- Potential new release? HOT 3
- Building against LLVM with `LLVM_BUILD_LLVM_DYLIB=OFF` HOT 2
- std::nullptr_t replacement to std::std::nullptr_t HOT 6
- Release 1.4.1 or 1.4.2? HOT 3
- Config option to rename namespace (or join it contents with some other namespace, even global) HOT 3
- FTBFS for LLVM 18 HOT 1
- Wrong code for MSVC 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 binder.