您好我的VC2008项目使用stdcall调用约定.我有一个我使用的外部库,它使用cdecl命名约定构建,但是他们没有在函数的函数声明中提到调用约定.
我想知道VC是否有某种#pragma或其他关键字会强制整个头文件的特定调用约定
有点像extern"C"技巧,但对于调用约定:
extern "C"
{
#include <file1.h>
#include <file2.h>
}
Run Code Online (Sandbox Code Playgroud)
谁知道这样的?
我在C++中有以下代码:
class Person
{
public:
enum Gender {Male, Female};
Gender GetGender() const;
}
Run Code Online (Sandbox Code Playgroud)
我用这种方式将它包装在boost :: python中:
BOOST_PYTHON_MODULE(TestPython)
{
scope the_scope = class_<Person>("Person")
.def("GetGender", &Person::GetGender);
enum_<Person::Gender>("Gender")
.value(Male, Person::Male)
.value(Female, Person::Female)
.export_values();
}
Run Code Online (Sandbox Code Playgroud)
当我尝试person.GetGender()从Python 调用时,我得到以下异常:
Can't pickle : attribute lookup **PyBF.TestPython.Gender**. It guesses the namespace of the Gender (which is actually **PyBF.TestPython.Person.Gender**) enum return type incorrectly.
如何告诉GetGender函数显式返回什么类型?
我从这里使用了一个示例项目来设置一个带有热模块替换的webpack项目.然后我建立了一个示例骨干应用程序.
// main.js
import $ from 'jquery';
import Backbone from 'backbone';
import Router from './router';
window.app = window.app || {};
const app = new Backbone.Marionette.Application();
app.addRegions({content: '#content'});
app.on('start', () => {
if (Backbone.history)
Backbone.history.start({ pushState: true })
}
);
app.addInitializer(() => {
return new Router();
});
$( () => { app.start() });
// HMR
if (module.hot) {
module.hot.accept();
}Run Code Online (Sandbox Code Playgroud)
我可以看到HRM根据[HMR] connected调试输出正在加载.当文件发生变化时,我可以看到它根据以下输出重建并推送到客户端的更新:
[HMR] Updated modules:
process-update.js?e13e:77 [HMR] - ./app/backbone/views/template.hbs
process-update.js?e13e:77 [HMR] - ./app/backbone/views/hello.js
process-update.js?e13e:77 [HMR] - ./app/backbone/router.js …Run Code Online (Sandbox Code Playgroud)