Skip to content

Conversion across modules #4

@mrzv

Description

@mrzv

The following works on Mac OS X, but not on Linux. (The obvious bits below, declarations of m and such, are ommited.)

// common.h

struct A {};
// a.cpp

#include "common.h"

PYBIND11_PLUGIN(a)
{
  py::class_<A>(m, "A")
      .def(py::init<>());
}
// b.cpp

#include "common.h"

PYBIND11_PLUGIN(b)
{
  m.def("test", [](A a) { fmt::print("test\n"); });
}
# test.py 

import a
import b

x = a.A()
b.test(x)

On Mac, this works fine. On Linux, I get:

TypeError: Incompatible function arguments. The following argument types are supported:
    1. (A) -> None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions