[Mod] updated TapQuoteApi.dll: use newer official provided x64 dll.

[Fix] fixed nullptr error.
This commit is contained in:
nanoric 2019-06-07 23:11:39 +08:00
parent a20eee2d44
commit a5e545ba0c
7 changed files with 49 additions and 26 deletions

Binary file not shown.

View File

@ -1,11 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# autocxxpy version: 0.2.4 # autocxxpy version: 0.2.5
python -m autocxxpy \ python -m autocxxpy \
vntap \ vntap \
iTapTradeAPI.h TapQuoteAPI.h TapAPIError.h iTapAPIError.h \ iTapTradeAPI.h TapQuoteAPI.h TapAPIError.h iTapAPIError.h \
-I vntap/include \ -I vntap/include \
-A custom/custom_wrappers.hpp\ -A custom/custom_wrappers.hpp\
--output-dir vntap/generated_files \ --output-dir vntap/generated_files \
--copy-autocxxpy-includes vntap/include \
--pyi-output-dir . \ --pyi-output-dir . \
\ \
--no-clear-pyi-output \ --no-clear-pyi-output \

Binary file not shown.

View File

@ -7,7 +7,7 @@ if typing.TYPE_CHECKING:
from .vntap import * from .vntap import *
def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], bool]): def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], None]):
""" """
set a customize exception handler for async callback in this module(pyd) set a customize exception handler for async callback in this module(pyd)
\a handler should return True if it handles that exception, \a handler should return True if it handles that exception,

View File

@ -48,11 +48,18 @@ namespace autocxxpy
{ {
inline static void call(ITapTrade::ITapTradeAPINotify* instance, const char* py_func_name, ITapTrade::TAPIUINT32 sessionID, ITapTrade::TAPIINT32 errorCode, const ITapTrade::TapAPIOrderActionRsp* info) inline static void call(ITapTrade::ITapTradeAPINotify* instance, const char* py_func_name, ITapTrade::TAPIUINT32 sessionID, ITapTrade::TAPIINT32 errorCode, const ITapTrade::TapAPIOrderActionRsp* info)
{ {
ITapTrade::TapAPIOrderInfo orderInfo = *info->OrderInfo; ITapTrade::TapAPIOrderInfo orderInfo;
if (info->OrderInfo != nullptr)
{
orderInfo = *info->OrderInfo;
}
ITapTrade::TapAPIOrderActionRsp copied_info = *info; ITapTrade::TapAPIOrderActionRsp copied_info = *info;
auto task = [=]() mutable auto task = [=]() mutable
{
if (copied_info.OrderInfo != nullptr)
{ {
copied_info.OrderInfo = &orderInfo; // ensure pointer is pointer to the correct address(address changes after constructed lambda) copied_info.OrderInfo = &orderInfo; // ensure pointer is pointer to the correct address(address changes after constructed lambda)
}
return default_callback_wrapper<&ITapTrade::ITapTradeAPINotify::OnRspOrderAction>::sync(instance, py_func_name, sessionID, errorCode, &copied_info); return default_callback_wrapper<&ITapTrade::ITapTradeAPINotify::OnRspOrderAction>::sync(instance, py_func_name, sessionID, errorCode, &copied_info);
}; };
dispatcher::instance().add(std::move(task)); dispatcher::instance().add(std::move(task));
@ -63,11 +70,18 @@ namespace autocxxpy
{ {
inline static void call(ITapTrade::ITapTradeAPINotify* instance, const char* py_func_name, const ITapTrade::TapAPIOrderInfoNotice* info) inline static void call(ITapTrade::ITapTradeAPINotify* instance, const char* py_func_name, const ITapTrade::TapAPIOrderInfoNotice* info)
{ {
ITapTrade::TapAPIOrderInfo orderInfo = *info->OrderInfo; ITapTrade::TapAPIOrderInfo orderInfo;
if (info->OrderInfo != nullptr)
{
orderInfo = *info->OrderInfo;
}
ITapTrade::TapAPIOrderInfoNotice copied_info = *info; ITapTrade::TapAPIOrderInfoNotice copied_info = *info;
auto task = [=]() mutable auto task = [=]() mutable
{
if (copied_info.OrderInfo != nullptr)
{ {
copied_info.OrderInfo = &orderInfo; // ensure pointer is pointer to the correct address(address changes after constructed lambda) copied_info.OrderInfo = &orderInfo; // ensure pointer is pointer to the correct address(address changes after constructed lambda)
}
return default_callback_wrapper<&ITapTrade::ITapTradeAPINotify::OnRtnOrder>::sync(instance, py_func_name, &copied_info); return default_callback_wrapper<&ITapTrade::ITapTradeAPINotify::OnRtnOrder>::sync(instance, py_func_name, &copied_info);
}; };
dispatcher::instance().add(std::move(task)); dispatcher::instance().add(std::move(task));
@ -79,11 +93,19 @@ namespace autocxxpy
{ {
inline static void call(ITapTrade::ITapTradeAPINotify* instance, const char* py_func_name, const ITapTrade::TapAPIPositionProfitNotice* info) inline static void call(ITapTrade::ITapTradeAPINotify* instance, const char* py_func_name, const ITapTrade::TapAPIPositionProfitNotice* info)
{ {
ITapTrade::TapAPIPositionProfit profit = *info->Data;
ITapTrade::TapAPIPositionProfit profit;
if (info->Data != nullptr)
{
profit = *info->Data;
}
ITapTrade::TapAPIPositionProfitNotice copied_info = *info; ITapTrade::TapAPIPositionProfitNotice copied_info = *info;
auto task = [=]() mutable auto task = [=]() mutable
{
if (copied_info.Data != nullptr)
{ {
copied_info.Data = &profit; // ensure pointer is pointer to the correct address(address changes after constructed lambda) copied_info.Data = &profit; // ensure pointer is pointer to the correct address(address changes after constructed lambda)
}
return default_callback_wrapper<&ITapTrade::ITapTradeAPINotify::OnRtnPositionProfit>::sync(instance, py_func_name, &copied_info); return default_callback_wrapper<&ITapTrade::ITapTradeAPINotify::OnRtnPositionProfit>::sync(instance, py_func_name, &copied_info);
}; };
dispatcher::instance().add(std::move(task)); dispatcher::instance().add(std::move(task));

View File

@ -7,7 +7,7 @@ if typing.TYPE_CHECKING:
from .vntap import * from .vntap import *
def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], bool]): def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], None]):
""" """
set a customize exception handler for async callback in this module(pyd) set a customize exception handler for async callback in this module(pyd)
\a handler should return True if it handles that exception, \a handler should return True if it handles that exception,