Problem using c++ functions with a custom framework
Problem using c++ functions with a custom framework
- Subject: Problem using c++ functions with a custom framework
- From: amir <email@hidden>
- Date: Thu, 23 Mar 2006 19:03:12 +0200
Hi
I have encountered a problem with trying to turn an existing carbon
Mach-O dylib into a carbon Mach-O framework and than use c++ functions
from this framework from a Mach-O Carbon application.
In order to simplify the problem I have done the following:
Created the most basic Mach-O carbon application using XCode template.
Created the most basic Mach-O carbon framework using XCode template.
Created just one c++ function on the framework and tried to call that
function from the carbon application. I have received the following
error on run time:
dyld: lazy symbol binding failed: Symbol not found: __Z6OdFooBari
Referenced from:
/ProAudio/XCodeBuildProducts/Debug/test3.app/Contents/MacOS/test3
Expected in:
/TomerCarbonFramework.framework/Versions/A/TomerCarbonFramework
When running nm on both the framework and the object file of the code
that calls the function on the application I can see that they both have
the same symbol for the function ( __Z6OdFoobari).
If I add an extern "C" definition before the function than the problem
is resolved, however using the C style functions is not an option for me
in the original application I was trying to debug (for example
because of the fact that I need to export classes as well).
I know that according to the Framework programming guide, the best way
to avoid incompatibility issues is to wrap the interface for C++
classes with ANSI c functions or use objective C. However both options
is not applicable to us in this case and since we are using the same
compiler for both the framework and the application I wonder whether
this should be required.
Can you please advise on what should be the method to use C++
functions and classes that are exported from a framework in an
application?
Thanks in advance,
Tomer
Hi
I have encountered a problem with trying to turn an existing carbon
Mach-O dylib into a carbon Mach-O framework and than use c++ functions
from this framework from a Mach-O Carbon application.
In order to simplify the problem I have done the following:
Created the most basic Mach-O carbon application using XCode template.
Created the most basic Mach-O carbon framework using XCode template.
Created just one c++ function on the framework and tried to call that
function from the carbon application. I have received the following
error on run time:
dyld: lazy symbol binding failed: Symbol not found: __Z6OdFooBari
Referenced from:
/ProAudio/XCodeBuildProducts/Debug/test3.app/Contents/MacOS/test3
Expected in:
/TomerCarbonFramework.framework/Versions/A/TomerCarbonFramework
When running nm on both the framework and the object file of the code
that calls the function on the application I can see that they both have
the same symbol for the function ( __Z6OdFoobari).
If I add an extern "C" definition before the function than the problem
is resolved, however using the C style functions is not an option for me
in the original application I was trying to debug (for example
because of the fact that I need to export classes as well).
I know that according to the Framework programming guide, the best way
to avoid incompatibility issues is to wrap the interface for C++
classes with ANSI c functions or use objective C. However both options
is not applicable to us in this case and since we are using the same
compiler for both the framework and the application I wonder whether
this should be required.
Can you please advise on what should be the method to use C++
functions and classes that are exported from a framework in an
application?
Thanks in advance,
Tomer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden