aboutsummaryrefslogtreecommitdiff
path: root/pd/src/s_loader.c
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2004-09-06 20:20:36 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2004-09-06 20:20:36 +0000
commited932acb5860bf8b9296169676499562a55d139e (patch)
treedc6a40dba908deb07c175cd40ee19c197318f72d /pd/src/s_loader.c
parentdad636821f6e7d3ead02c157f308c0ceeba9af3d (diff)
checking in version 0.38test5.
Oops, I realize I forgot some more nice files, will add them and re-commit. svn path=/trunk/; revision=2010
Diffstat (limited to 'pd/src/s_loader.c')
-rw-r--r--pd/src/s_loader.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c
index c210206c..75f638f1 100644
--- a/pd/src/s_loader.c
+++ b/pd/src/s_loader.c
@@ -5,7 +5,7 @@
#ifdef DL_OPEN
#include <dlfcn.h>
#endif
-#ifdef UNIX
+#ifdef UNISTD
#include <stdlib.h>
#include <unistd.h>
#endif
@@ -49,7 +49,7 @@ void class_set_extern_dir(t_symbol *s);
int sys_load_lib(char *dirname, char *classname)
{
char symname[MAXPDSTRING], filename[MAXPDSTRING], dirbuf[MAXPDSTRING],
- classname2[MAXPDSTRING], *nameptr, *lastdot;
+ classname2[MAXPDSTRING], *nameptr, *lastdot;
void *dlobj;
t_xxx makeout = NULL;
int fd;
@@ -59,36 +59,36 @@ int sys_load_lib(char *dirname, char *classname)
#if 0
fprintf(stderr, "lib %s %s\n", dirname, classname);
#endif
- /* try looking in the path for (classname).(sys_dllextent) ... */
+ /* try looking in the path for (classname).(sys_dllextent) ... */
if ((fd = open_via_path(dirname, classname, sys_dllextent,
- dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
{
- /* next try (classname)/(classname).(sys_dllextent) ... */
- strncpy(classname2, classname, MAXPDSTRING);
- filename[MAXPDSTRING-2] = 0;
- strcat(classname2, "/");
- strncat(classname2, classname, MAXPDSTRING-strlen(classname2));
- filename[MAXPDSTRING-1] = 0;
- if ((fd = open_via_path(dirname, classname2, sys_dllextent,
- dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
- {
- return (0);
- }
+ /* next try (classname)/(classname).(sys_dllextent) ... */
+ strncpy(classname2, classname, MAXPDSTRING);
+ filename[MAXPDSTRING-2] = 0;
+ strcat(classname2, "/");
+ strncat(classname2, classname, MAXPDSTRING-strlen(classname2));
+ filename[MAXPDSTRING-1] = 0;
+ if ((fd = open_via_path(dirname, classname2, sys_dllextent,
+ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+ {
+ return (0);
+ }
}
close(fd);
class_set_extern_dir(gensym(dirbuf));
- /* refabricate the pathname */
+ /* refabricate the pathname */
strncpy(filename, dirbuf, MAXPDSTRING);
filename[MAXPDSTRING-2] = 0;
strcat(filename, "/");
strncat(filename, nameptr, MAXPDSTRING-strlen(filename));
filename[MAXPDSTRING-1] = 0;
- /* extract the setup function name */
+ /* extract the setup function name */
if (lastdot = strrchr(nameptr, '.'))
- *lastdot = 0;
+ *lastdot = 0;
#ifdef MACOSX
strcpy(symname, "_");
@@ -96,18 +96,18 @@ int sys_load_lib(char *dirname, char *classname)
#else
strcpy(symname, nameptr);
#endif
- /* if the last character is a tilde, replace with "_tilde" */
+ /* if the last character is a tilde, replace with "_tilde" */
if (symname[strlen(symname) - 1] == '~')
- strcpy(symname + (strlen(symname) - 1), "_tilde");
- /* and append _setup to form the C setup function name */
+ strcpy(symname + (strlen(symname) - 1), "_tilde");
+ /* and append _setup to form the C setup function name */
strcat(symname, "_setup");
#ifdef DL_OPEN
dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
if (!dlobj)
{
- post("%s: %s", filename, dlerror());
- class_set_extern_dir(&s_);
- return (0);
+ post("%s: %s", filename, dlerror());
+ class_set_extern_dir(&s_);
+ return (0);
}
makeout = (t_xxx)dlsym(dlobj, symname);
#endif
@@ -116,9 +116,9 @@ int sys_load_lib(char *dirname, char *classname)
ntdll = LoadLibrary(filename);
if (!ntdll)
{
- post("%s: couldn't load", filename);
- class_set_extern_dir(&s_);
- return (0);
+ post("%s: couldn't load", filename);
+ class_set_extern_dir(&s_);
+ return (0);
}
makeout = (t_xxx)GetProcAddress(ntdll, symname);
#endif
@@ -130,11 +130,11 @@ int sys_load_lib(char *dirname, char *classname)
if ( NSCreateObjectFileImageFromFile( filename, &image) != NSObjectFileImageSuccess )
{
post("%s: couldn't load", filename);
- class_set_extern_dir(&s_);
+ class_set_extern_dir(&s_);
return 0;
}
- ret = NSLinkModule( image, filename,
- NSLINKMODULE_OPTION_BINDNOW + NSLINKMODULE_OPTION_PRIVATE);
+ ret = NSLinkModule( image, filename,
+ NSLINKMODULE_OPTION_BINDNOW + NSLINKMODULE_OPTION_PRIVATE);
s = NSLookupSymbolInModule(ret, symname);
@@ -146,9 +146,9 @@ int sys_load_lib(char *dirname, char *classname)
if (!makeout)
{
- post("load_object: Symbol \"%s\" not found", symname);
- class_set_extern_dir(&s_);
- return 0;
+ post("load_object: Symbol \"%s\" not found", symname);
+ class_set_extern_dir(&s_);
+ return 0;
}
(*makeout)();
class_set_extern_dir(&s_);