Freescale USB Stack and C++

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Freescale USB Stack and C++

跳至解决方案
1,885 次查看
weblar
Contributor V

Hi,

I have a C++ application in which I'd like to use the Freescale USB stack, specifically the MSD class.

From previous experience, I've had to decorate my C prototypes with extern "C" in order for them to work in C++, due to the way the linker works.

Will I have to do exactly the same with all routines that make up the USB stack?

Thanks,

Kev

标签 (2)
标记 (3)
0 项奖励
回复
1 解答
1,647 次查看
BlackNight
NXP Employee
NXP Employee

Hello,

with 'extern "C"' you need to mark interfaces you are calling from C++. So whatever you have compiled in C mode, and gets called by C++ code, needs to be marked with that extern "C".

As for the MSD stack, this would only apply to a few routines, I guess. It just depends how you structure your application and the interface to the stack.

Hope this helps,

Erich

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,648 次查看
BlackNight
NXP Employee
NXP Employee

Hello,

with 'extern "C"' you need to mark interfaces you are calling from C++. So whatever you have compiled in C mode, and gets called by C++ code, needs to be marked with that extern "C".

As for the MSD stack, this would only apply to a few routines, I guess. It just depends how you structure your application and the interface to the stack.

Hope this helps,

Erich

0 项奖励
回复
1,647 次查看
weblar
Contributor V

Thanks for your reply.

I've done as you've mentioned and this works perfectly.

Thanks,

Kev

0 项奖励
回复