Obtain a brep extruding a curve

I am trying to extrude a quadrilateral closed curve to obtain a brep. I am using RhinoExtrudeCurveStraight function, but this returns a surface. If I obtain the brep (surface.BrepForm()), the brep only has one face. How can I get a correct brep when I extrude a curve with corners? In this case, I’d like a brep with four faces.

Thanks in advance.

I have not tried this, but it would work:

ON_Surface* srf = RhinoExtrudeCurveStraight( crv, dir );
if( 0 != srf )
  ON_Brep* brep = ON_Brep::New(); // we are responsible for this memory
  brep->Create( srf ); // Brep now owns this memory...
  if( brep->IsValid() )
    // TODO....

Let me know if you find otherwise.

Thanks! That’s just what I needed