从C转换为C ++ ---中断例程问题==>中断远 [英] Converting from C to C++ --- Having Issue with interrupt routine ==> interrupt far

查看:52
本文介绍了从C转换为C ++ ---中断例程问题==>中断远的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C编写的应用程序。它仅适用于WIN 32位,我们决定将代码转换为C ++,以便在64位Windows机器上使用它。 

I have an application written in C. It works only on WIN 32 bit and we decide to convert the code to C++ in order to use it on 64 bit Windows Machine as well. 

转换代码后我得到的第一个错误是以下错误。

The first error that I've got after converting my code was the following one.

/ **** *********************************** /

/ *串行例程变量定义* / b
/ *************************************** /
$


/ *这些指针存储原始中断向量

用于com端口* /

/***************************************/
/* Serial routine variable definitions */
/***************************************/

/* these pointers store the original interrupt vectors
for the com ports */

static void(interrupt far * org_empcom_vector)(void);   //错误行 

static void (interrupt far *org_empcom_vector)(void);   // error line 

错误 5
错误C4430:缺少类型说明符 - 假设为int。注意:C ++不支持default-int
c:\ usersrs \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ consoleapplication5\consoleapplication5 \consoleapplication5.cpp
676 1
ConsoleApplication5

Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\me\documents\visual studio 2013\projects\consoleapplication5\consoleapplication5\consoleapplication5.cpp 676 1 ConsoleApplication5

因此,我意识到C ++中的中断例程与C不同。

Therefore, I realized that interrupt routine in C++ is different than C.

我上网查找解决方法。最后,我最终得到了以下几行代替。

I surfed the net to find a workaround for this. Eventually, I was ended up with the following lines to replace.

void _interrupt(...)

{

void * org_empcom_vector(void);

void * org_meter_vector(void);

}

void _interrupt(...)
{
void *org_empcom_vector(void);
void *org_meter_vector(void);
}

因此,Visual Studio出现了以上更换没有错误。但是,我并不完全确定这是否是定义中断向量的正确方法。

So, Visual Studio came up with no error with the above replacement. However, I am not entirely too sure that this is the right way to define interrupt vectors or not.

所以,我想让你就此与我分享你的看法。谢谢,麻烦您了! :)

So, I want you to share your opinion with me on this. Please and thank you! :)

推荐答案

为什么您认为需要将代码编译为C ++而不是C代表64位系统?
Why do you think you need to compile code as C++ instead of C for a 64 bit system?


这篇关于从C转换为C ++ ---中断例程问题==>中断远的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆