Skip to content

feat: selectively attach a type or method and all its dependencies #220

@roy-t

Description

@roy-t

Let's take the following pseudo header file as an example

struct WHEEL { 
    float rimSize; 
} Wheel;

enum DriveType { Front, Rear, All };

struct CAR { 
    Wheel wheels[4]; 
    DriveType driveType;
    float weight;
} Car;

void ReverseCar(Car car);

// a lot of other stuff we're not interested in

Right now you would have to write the following mappings.xml file to make use of the ReverseCar method.

<?xml version="1.0" encoding="utf-8"?>
<config id="id" xmlns="urn:SharpGen.Config">
  <namespace>Foo</namespace>
  <include file="vehicles.h" namespace="Foo.Cars">
    <attach>Wheel</attach>
    <attach>DriveType</attach>
    <attach>Car</attach>
    <attach>ReverseCar</attach>
  </include>

I would like to be able to simplify this to:

<?xml version="1.0" encoding="utf-8"?>
<config id="id" xmlns="urn:SharpGen.Config">
  <namespace>Foo</namespace>
  <include file="cars.h" namespace="Foo.Cars">
    <attach>ReverseCar</attach>
  </include>

Which should automatically attach all the types, enums, etc... needed to make the ReverseCar method work. I would hope this would work directly. But otherwise we could add an attribute to the attach tag like AutoAttachDependencies=true or something like that.

It would be nice if this would work anything that you can attach, not just functions.

Disclaimer: I'm super new to SharpGen so I have no clue about the technical complexity to make this work, or if there are already other ways to accomplish this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions