ClangSharp icon indicating copy to clipboard operation
ClangSharp copied to clipboard

A lot of unexpected generation

Open ankyo opened this issue 7 months ago • 1 comments

    const TAPICallOrPutFlagType		TAPI_CALLPUT_FLAG_CALL				= 'C';
    const TAPICallOrPutFlagType		TAPI_CALLPUT_FLAG_PUT				= 'P';
    const TAPICallOrPutFlagType		TAPI_CALLPUT_FLAG_NONE				= 'N';
struct TapAPINewOrder {
public:
		TapAPINewOrder()
		{
			memset(this, 0, sizeof(TapAPINewOrder));
			CallOrPutFlag = TAPI_CALLPUT_FLAG_NONE;
			CallOrPutFlag2 = TAPI_CALLPUT_FLAG_NONE;
			OrderSource = TAPI_ORDER_SOURCE_PROGRAM;
			TimeInForce=TAPI_ORDER_TIMEINFORCE_GFD;
			IsRiskOrder = APIYNFLAG_NO;
			PositionEffect = TAPI_PositionEffect_NONE;
			PositionEffect2 = TAPI_PositionEffect_NONE;
			HedgeFlag = TAPI_HEDGEFLAG_NONE;
			OrderMinQty = 1;
			TacticsType = TAPI_TACTICS_TYPE_NONE;
			TriggerCondition = TAPI_TRIGGER_CONDITION_NONE;
			TriggerPriceType = TAPI_TRIGGER_PRICE_NONE;
			AddOneIsValid = APIYNFLAG_YES;
		}
    };
}

result


 [StructLayout(LayoutKind.Sequential, Pack = 1)]
 public unsafe partial struct TapAPINewOrder
{
public TapAPINewOrder()
{
    Unsafe.InitBlockUnaligned(this, 0, (uint)(sizeof(TapAPINewOrder)));  // not use ref
    CallOrPutFlag = TAPI_CALLPUT_FLAG_NONE;  // TAPI_CALLPUT_FLAG_NONE not found
    CallOrPutFlag2 = TAPI_CALLPUT_FLAG_NONE;
    OrderSource = TAPI_ORDER_SOURCE_PROGRAM;
    TimeInForce = TAPI_ORDER_TIMEINFORCE_GFD;
    IsRiskOrder = APIYNFLAG_NO;
    PositionEffect = TAPI_PositionEffect_NONE;
    PositionEffect2 = TAPI_PositionEffect_NONE;
    HedgeFlag = TAPI_HEDGEFLAG_NONE;
    OrderMinQty = 1;
    TacticsType = TAPI_TACTICS_TYPE_NONE;
    TriggerCondition = TAPI_TRIGGER_CONDITION_NONE;
    TriggerPriceType = TAPI_TRIGGER_PRICE_NONE;
    AddOneIsValid = APIYNFLAG_YES;
}

[test.zip](https://github.com/user-attachments/files/20369172/test.zip)

}
``` #

ankyo avatar May 21 '25 13:05 ankyo

More context would be appreciated

Including examples of what commands you used, what the expected codegen would be, etc.

If you can create a minimal repro, that's all the better.

tannergooding avatar May 24 '25 02:05 tannergooding

Closing due to no response.

There's not enough context here for this to be actionable and the user attachment resolves as "does not exist".

tannergooding avatar Sep 05 '25 19:09 tannergooding