Skip to content

Commit b4cb2c0

Browse files
committed
Modified CFunction to initialize CallingConvention with default_convention class variable.
1 parent 118070b commit b4cb2c0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/core/modules/memory/memory_function.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,19 @@ CFunction::CFunction(unsigned long ulAddr, object oCallingConvention, object oAr
154154

155155
// A custom calling convention will be used...
156156
m_eCallingConvention = CONV_CUSTOM;
157-
m_oCallingConvention = oCallingConvention(m_tArgs, m_eReturnType);
157+
158+
// Check if default_convention is defined.
159+
if (PyObject_HasAttrString(oCallingConvention.ptr(), "default_convention"))
160+
{
161+
// Extract default_convention and pass it to oCallingConvention.
162+
Convention_t eCallingConvention = extract<Convention_t>(oCallingConvention.attr("default_convention"));
163+
m_oCallingConvention = oCallingConvention(m_tArgs, m_eReturnType, 4, eCallingConvention);
164+
}
165+
else
166+
{
167+
m_oCallingConvention = oCallingConvention(m_tArgs, m_eReturnType);
168+
}
169+
158170
m_pCallingConvention = extract<ICallingConvention*>(m_oCallingConvention);
159171

160172
// Reserve a Python reference for DynamicHooks.

0 commit comments

Comments
 (0)