Skip to content
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

Conversation

genuinelucifer
Copy link
Contributor

@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 .

@genuinelucifer
Copy link
Contributor Author

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.

{
public class MarshalStructAsValTypeIfPossiblePass : TranslationUnitPass
{

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra newline here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove.

@genuinelucifer
Copy link
Contributor Author

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.

@ddobrev
Copy link
Contributor

ddobrev commented Jul 21, 2015

@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.

@genuinelucifer
Copy link
Contributor Author

@ddobrev @tritao Sorry. I was leaving for some place and wrote that in a hurry.
Since it is not supported so i don't think there is any need of keeping it. I will remove it.

@genuinelucifer genuinelucifer deleted the finalStructToStructMarshalling branch August 1, 2015 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants