-
Notifications
You must be signed in to change notification settings - Fork 497
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
Added a pass to allow struct to struct marshalling if possible #518
Added a pass to allow struct to struct marshalling if possible #518
Conversation
As far as I have checked it, now it has to have a check that if there is an explicitly defined constructor/destructor [like in 'TestDestructor' in CSharpTemp.h] then too it must NOT be marshalled as a struct. |
f783d9a
to
180535b
Compare
{ | ||
public class MarshalStructAsValTypeIfPossiblePass : TranslationUnitPass | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra newline here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove.
if we have code like: struct RefType
{
protected:
int n;
public:
virtual int getN() { return n; }
};
struct CS_VALUE_TYPE ValType : public RefType
{
}; Then uncompilable code was generated. We simply copy members from the base into the derived type if the derived type is a value type. But value types can't have protected &/or virtual members. So, i just wanted to fix that. |
@genuinelucifer your answer shows that you've ignored part of @tritao 's question. He's asked you if the code is STILL necessary when you consider our new discovery - value types cannot derive from ref types in C# either. |
@tritao @ddobrev Please review. It is based on one of my earlier pulls and the first commit is from that only.
This pull tries to address #500 .