ruoruoniao opened a new issue, #3747:
URL: https://github.com/apache/fory/issues/3747
### Question
My cpp project is using like a plugin loader. I want to hide implement and
it can upgrade and compatible old version dll/so without rebuild. Like:
```cpp
//AImpl.h (Hide)
struct AImpl {
int a;
}
//A.h
class AImpl;
struct A {
... codes
auto a() const -> const int &;
auto a() -> int &;
auto a(int v) -> A &;
private:
AImpl * _impl = nullptr;
}
//A.cpp
... codes
```
But I cannot use `FORY_STRUCT` to register `A`. I can only make a new
`Serializer<A>`. That's all right, but it only can be register with
`register_extension_type<A>("A")`. Then, type id of `A` will be
`NAMED_EXT(32)`.
But if I use:
```python
//data.py
...codes
@dataclass
class A:
a: int = 0
```
Type id of `A` will be `NAMED_COMPATIBLE_STRUCT(32)`. I can route
`Serializer<A>` method into `Serializer<AImpl>`, then `A` can be
serialize/deserialize, but if I use a struct with `A`, like:
```cpp
struct B {
A a{};
};
```
It will skip a, because type id is `30` against `32`. (Correct if in cpp it
self.)
How can I use a pimpl class/struct under `xlang`? What is the best implement?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]