Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > C vs C++

C vs C++
Thread Tools
Fresh-Faced Recruit
Join Date: Oct 2002
Location: Vancouver, Canada
Status: Offline
Reply With Quote
Jul 21, 2003, 09:14 PM
 
Hi guys. I have been writing a iTunes visual plugin and after some hours of investigation realized that the reason iTunes is not recognising my plugin is because it is written in c++.

I took the sample plugin from the itunes sdk and put 1 line of c++ code into it and compiled. This newly compiled bundle failed to be recognised by iTunes. My question is what must I do in order to be able to write my plugin in c++ and still have itunes recognise it.

My second question is why does this happen. I believed that c code can call c++ code but it appears not. Can someone please clarify for me.

Thanx a mil
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jul 21, 2003, 11:48 PM
 
C++ "mangles" exported symbols differently from how C does it. Your symbols need to be exported using C's methodology.

In the header file that defines whatever functions iTunes needs to interface with, place the following before the function prototypes:
Code:
#ifdef __cplusplus extern "C" { #endif
At the end of the function prototypes, put
Code:
#ifdef __cplusplus } #endif
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
oexel  (op)
Fresh-Faced Recruit
Join Date: Oct 2002
Location: Vancouver, Canada
Status: Offline
Reply With Quote
Jul 23, 2003, 02:17 AM
 
thank you so much smeger....that's what i thought but i had placed my extern "C"{ before the body of the function not before the prototype. Anyways, worx as expected now.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:12 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2