Re: dlopen woes under XCode 2.1
Re: dlopen woes under XCode 2.1
- Subject: Re: dlopen woes under XCode 2.1
- From: Quinn Dunki <email@hidden>
- Date: Sat, 25 Jun 2005 12:57:59 -0700
Upon further investigation, I've learned more about this problem. It
appears to be only 1 of my 8 plugins that is malfunctioning.
Furthermore, it is doing so in a very specific way. For some reason,
when it encounters this block of code (simplified for testing):
switch (foo) // foo is 0-3
{
case 0:
case 1:
case 3:
int goo=0;
return;
default:
int bar=1;
return;
}
... it crashes after the bgt- branch instruction for the top of the
switch. In this test, foo is 0. The bgt- branch does not jump to the
goo line, however. It jumps to the next line of assembly which
contains an illegal instruction.
Now, if I change the code to this roughly logically equivalent version:
if (foo!=2)
{
int goo=0;
return;
}
int bar=1
return;
... everything is fine. The same switch statement above is used in
all 8 plugins, but gcc (3.3) generates illegal code in one of them. I
have deleted the target for that plugin, recreated the source, done
many cleans and rebuilds, and what not, all to no avail. I've got the
above if statement as a workaround, but it sure is puzzling, and I'd
like to know what's going on. Anyone have any thoughts?
The code in question is compiled with gcc 3.3 (using XCode 2.1), run
under 10.4.1, and is the sole C function in a BSD Dynamic Library
target that is loaded by dlopen. The code in question worked fine
under XCode 2.0 (I think) and XCode 1.5 (verified).
-Sandy
On Jun 25, 2005, at 11:37 AM, Quinn Dunki wrote:
Hey, folks!
I've been using BSD dylibs as plugins in my cross-platform
application (running under 10.4.1 & Win32). I've been loading them
with dlopen(), and everything was fine.
Upon upgrading to XCode 2.1, they stopped working. They were no
longer being recognized as loadable libs by dlopen. I had done
something weird in XCode 1.5 to get them to work. I had created the
targets as BSD dylibs, but then switched the Library Style setting
to Bundle in the target settings for each plugin. If I didn't do
this, I got weird random crashes in the plugins due to illegal
instructions. For some reason changing the Library Style to Bundle
fixed them, even though they weren't really OS X Bundles.
In XCode 2.1, dlopen refused to load them again, so I switched the
Library Styles back to Dynamic. Now they're loading again, but the
random crashes are back (although less than before).
I'm at a loss here. Can someone explain the proper way to build a
dynamic library that can be used with dlopen?
I experimented briefly with using CFBundles (and a proper Carbon
Bundle target), but CFBundleGetFunctionPointerForName can't find my
exported C functions for some reason. Any suggestions would be very
much appreciated.
-Sandy
_______________________________________________
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
_______________________________________________
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