summaryrefslogtreecommitdiff
path: root/quickexec/johns/so_stub.c
authorkergoth <kergoth>2002-01-25 22:14:26 (UTC)
committer kergoth <kergoth>2002-01-25 22:14:26 (UTC)
commit15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff)
treec2fa0399a2c47fda8e2cd0092c73a809d17f68eb /quickexec/johns/so_stub.c
downloadopie-15318cad33835e4e2dc620d033e43cd930676cdd.zip
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2
Initial revision
Diffstat (limited to 'quickexec/johns/so_stub.c') (more/less context) (ignore whitespace changes)
-rw-r--r--quickexec/johns/so_stub.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/quickexec/johns/so_stub.c b/quickexec/johns/so_stub.c
new file mode 100644
index 0000000..fe71f9c
--- a/dev/null
+++ b/quickexec/johns/so_stub.c
@@ -0,0 +1,23 @@
1#include <stdio.h>
2#include <string.h>
3#include <dlfcn.h>
4
5
6int main( int argc, char *argv[] ) {
7 char module[1024];
8 int (*loadedMain)( int argc, char *argv[] );
9 char *error;
10 int retVal = 0;
11 void *handle;
12 strcpy( module, argv[0] );
13 strcat( module, ".so" );
14 if ( !(handle = dlopen( module, RTLD_LAZY ) ) )
15 fputs( dlerror(), stderr ), exit( 1 );
16 loadedMain = dlsym( handle, "main" );
17 if ( ( error = dlerror() ) != NULL )
18 fputs( error, stderr ), exit( 1 );
19 retVal = (*loadedMain)( argc, argv );
20 dlclose( handle );
21 return retVal;
22}
23