Thanks Jon!
I have used your first approach and that did the trick. I am glad you
told me 'cause I would have never guessed that.
Now I'll continue to fix some errors with missing libraries but that
should be easier ;-)
On May 11, 2005, at 14:12 , Jonathan Johnson wrote:
On May 11, 2005, at 5:33 AM, Alex Fischer wrote:
Hi to all:
I have been reading you for a while now and hope you can now help
me ;-)
For some time now I have been developing plugins in CodeWarrior
and want to go now the way to start doing so in XCode. I have
created a basic Mach-O plugin that compiles perfectly and works
fine. The problem comes when I try to extend the plugin with more
functionality.
I am trying to implement some Cocoa functions. As Apple
development says this is possible from Carbon if you write a C
callable wrapper function. To do so I have created a "misc.m" file
and included the function there. The file seems to compile well. I
have also created a "misc.h" file and included the C function
definition there. The main plugin code file includes "#include
misc.h". The problem is that when I try to call the function I get
an linker error saying there is an "unresolved symbol error"
giving a cryptic name resembling the one of my wrapper function.
You have probably noticed that I am not very experienced to C
programming and there is probably just an error in how I organize
and reference the files due to lack in knowledge of that type of
programming. I have tried all kinds of solutions but nothing works.
One approach was to include the wrapper function in the main
plugin file but that seems not too bee possible as it gives me a
lot of errors. Seems a problem of mixing C and Obj-C.
Well I hope I have explained myself and somebody can give me a
clue of what I am doing wrong.
Objectice-C is a superset of C, not C++, so the link signatures are
those of what C would be. You can fix this in two ways (I prefer
the first approach, because Objective-C++ has been a little funky
to me :P):
1) Inside of your header, put this at the top:
#ifdef __cplusplus
extern "C" {
#endif
And this at the bottom:
#ifdef __cplusplus
}
#endif
This will make the C++ compiler treat functions declared in your
header as if they were C functions.
2) Change the extension of your file to .mm. This makes GCC treat
your file as Objective-C++ which should solve your problems.
Again, I haven't had much experience with #2, and I generally take
approach #1.
HTH,
Jon
--
Jonathan Johnson
REAL Software, Inc.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|