<flushleft><fontfamily><param>Helvetica</param><x-tabstops><param>28L;56L;84L;112L;140L;168L;196L;224L;252L;280L;308L;336L;</param>What is the right file type for NSCreateObjectFileImageFromFile?

What is the right combinations of ld options to use?

Anybody have any examples that work for them?


Where can I find documentation on NSCreateObjectFileImageFromFile?

I searched all over the Apple developer web pages and all over the docs online 

with the developer tools on the public beta.   Still no luck.  


Background:


I am trying to get an extension to Python to link and load on Mac OS X public beta.


I can get it to link OK producing a file named LTXMLintermodule.so


But when python tries to load that thing in (dynload_next.c) it is doing a call to:


rc = NSCreateObjectFileImageFromFile(pathname, &image);


which returns a bad rc value:


(gdb) print rc

$1 = NSObjectFileImageInappropriateFile

(gdb) print pathname

$2 = 0xbfffd634 "/Apps/org/xml/ltxml/PyLTXML/LTXMLintermodule.so"


Doing a hex dump of the file confirms that the executable file type is 1:

od -xa XMLintermodule8.so | head -2

0000000     feed    face    0000    0012    0000    0000    0000    0001

          fe  ed  fa  ce nul nul nul dc2 nul nul nul nul nul nul nul soh


The last 4 bytes are the filetype. 

from loader.h:

062:00090 #define       MH_OBJECT       0x1             /* relocatable object file */

062:00091 #define       MH_EXECUTE      0x2             /* demand paged executable file */

062:00092 #define       MH_FVMLIB       0x3             /* fixed VM shared library file */

062:00093 #define       MH_CORE         0x4             /* core file */

062:00094 #define       MH_PRELOAD      0x5             /* preloaded executable file */

062:00095 #define       MH_DYLIB        0x6             /* dynamicly bound shared library file*/

062:00096 #define       MH_DYLINKER     0x7             /* dynamic link editor */

062:00097 #define       MH_BUNDLE       0x8             /* dynamicly bound bundle file */


I have tried many combinations of ld options like -dyld, -bundle, -dylinker, -fvmlib, 

-preload   


Some of them give me unresolved references or other ld complaints. 

None of them will successfully load.


Any clues? 

</x-tabstops></fontfamily><fontfamily><param>Geneva</param><x-tabstops><param>28L;56L;84L;112L;140L;168L;196L;224L;252L;280L;308L;336L;</param>------------------------------------------------------------------------

Michael Burns                                email: <underline><color><param>0000,0000,FFFF</param>Michael.Burns@sas.com</color></underline>

Principal Systems Developer           home: <underline><color><param>0000,0000,FFFF</param>mburns@bga.com</color></underline> 

Metadata Integration Technology    voice: (512)258-5171x3264

SAS Institute, Inc.                             fax: (512)258-3906

11920 Wilson Parke Ave.                www: <underline><color><param>0000,0000,FFFF</param>http://www.realtime.net/~mburns</color></underline>

Austin, TX 78726-4052                   sww: <underline><color><param>0000,0000,FFFF</param>http://sww.sas.com/~sasmkb</color></underline>

"choose for yourselves today whom you will serve;...

 but as for me and my house, we will serve the Lord." Joshua 24:15</x-tabstops></fontfamily></flushleft>
