c++ - The value of ESP was not properly saved across a function call error -


i made .dll file qt , load in application. when it's return 1 function, receive:

the value of esp not saved across function call

i start dll project:

this device_manager_interface.hpp:

#ifndef __device_manager_interface_hpp__ #define __device_manager_interface_hpp__  #include <qtcore>  class devicemanagerinterface { public:     virtual bcr * getdevicebcr() = 0 ;     .     .     .      };  qt_begin_namespace q_declare_interface(devicemanagerinterface,"some_info"); qt_end_namespace  #endif //__device_manager_interface_hpp__ 

this device_manager.hpp:

#ifndef __device_manager_base_hpp__ #define __device_manager_base_hpp__  #include "device_manager_interface.hpp"  class devicemanager : public devicemanagerinterface { public:     devicemanager();     virtual bcr * getdevicebcr();     .     .     .  protected:     virtual void initilzeavailabledevices(devicelist device_list);     virtual word startup();     .            .      .     };  #endif //__device_manager_base_hpp__ 

this device_manager.cpp:

#include "device_manager.hpp"  devicemanager::devicemanager() {  }  void winapi devicemanager::initilzeavailabledevices(devicelist device_list) {     word wfs_version = startup();     .     .     . }  word devicemanager::startup() {     wfsversion wfs_version;     hresult hres;      hres = wfsstartup(supported_versions, &wfs_version);      word version = wfs_version.wversion;      return version; } 

wfsstartup function containing in xfsapi.h , defined this.

hresult extern winapi wfsstartup ( dword dwversionsrequired, lpwfsversion lpwfsversion); 

this device_manager_impl.hpp:

#ifndef __device_manager_wincore_hpp__ #define __device_manager_wincore_hpp__  #include "device_manager.hpp"  class devicemanagerimpl : public qobject, devicemanager {     q_object     q_interfaces(devicemanagerinterface) public:     devicemanagerimpl();  protected:     .     .     . };  #endif //__device_manager_wincore_hpp__ 

this device_manager_impl.cpp:

#include "device_manager_impl.hpp"  #include "xfsapi.h"  #define brand_name "wincore"  devicemanagerimpl::devicemanagerimpl() {     m_brand_name = brand_name;     fill_map_logical_names();     devicelist device_list = detectavailabledevices();     devicemanager::initilzeavailabledevices(device_list); }  q_export_plugin2(device_manager_impl, devicemanagerimpl); 

this project provides dll file called wincore.dll.

this how load .dll:

qpluginloader* pluginloader = new qpluginloader(filename);  qobject *plugin = pluginloader->instance(); 

the filename contains wincore.dll path , it's correct. problem startup() in devicemanager class. when wants return version, error. doing wrong?

i found how fix problem!

right click on project , choose properties , go configuration properties , select c/c++ select code generation .

change basic run time check default.

change struct member alliance 1 byte (/zp1) .

i hope work guys too.

best regards


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -