Freescale USB Stack and C++

cancel
Showing results for 
Search instead for 
Did you mean: 

Freescale USB Stack and C++

Jump to solution
478 Views
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

Labels (2)
Tags (3)
0 Kudos
1 Solution
240 Views
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

View solution in original post

0 Kudos
2 Replies
241 Views
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 Kudos
240 Views
weblar
Contributor V

Thanks for your reply.

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

Thanks,

Kev

0 Kudos