[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]progress on x11-winforms on os x

From: Ian Fung
Subject: [DotGNU]progress on x11-winforms on os x
Date: Sun, 15 Jun 2003 00:19:33 -0400


we should think about using dlcompat instead of calling all the NS*
functions ourselves, for example, this is the dlopen() function in
dlcompat. but right now let's just try to get something to show up on
os x first.

void *dlopen(const char *path, int mode)
        void *module = 0;
        NSObjectFileImage ofi = 0;
        NSObjectFileImageReturnCode ofirc;
        static int (*make_private_module_public) (NSModule module) = 0;
        unsigned int flags =  NSLINKMODULE_OPTION_RETURN_ON_ERROR |

        /* If we got no path, the app wants the global namespace, use -1 as
the marker
           in this case */
        if (!path)
                return (void *)-1;

        /* Create the object file image, works for things linked with the
-bundle arg to ld */
        ofirc = NSCreateObjectFileImageFromFile(path, &ofi);
        switch (ofirc)
                case NSObjectFileImageSuccess:
                        /* It was okay, so use NSLinkModule to link in the 
image */
                        if (!(mode & RTLD_LAZY)) flags += 
                        module = NSLinkModule(ofi, path,flags);
                        /* Don't forget to destroy the object file image, 
unless you like
leaks */
                        /* If the mode was global, then change the module, this 
                           multiply defined symbol errors to first load private 
then make
                           global. Silly, isn't it. */
                        if ((mode & RTLD_GLOBAL))
                          if (!make_private_module_public)
                                (unsigned long *)&make_private_module_public);
                case NSObjectFileImageInappropriateFile:
                        /* It may have been a dynamic library rather than a 
bundle, try to
load it */
                        module = (void *)NSAddImage(path, 
                case NSObjectFileImageFailure:
                        error(0,"Object file setup failure :  \"%s\"", path);
                        return 0;
                case NSObjectFileImageArch:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]