Dynamic Loading and dynamic linking 
Author Message
 Dynamic Loading and dynamic linking

This seems to be a newsgroup with some people who are
familiar with the implementation of programming languages.
So perhaps someone can provide me some information or direct me to
a more relevant newsgroup.

I understand that dynamic loading is a technique by which one can
enhance the efficiency of a programming language implementation.
For example at in pub/statlib/S there is a file called
dynload.2 so that foreign functions can be dynamically loaded into
the programming language S.

Now, I've been hacking the source to the functional programming
language J and similarly, and, if program preformance can be enhanced,
I would like to dynamically load all of the foreign functions,
mostly LAPACK functions, I've been interfacing with the language.

My strategy is to mimic the dynload.2 example and
bsd-dyna-link from comp.sources.

I am seeking :
 1. Opinions on how this might help performance,
 2. Suggestions,
 3. Advice on whether I should dynamically load
    more than foreign functions but primitive functions as well, and
 3. An explanation of what this does. (See also the example excerpt

Also, perhaps someone might clear up some thing which confuses me.
The program bsd-dyna-link looks very similiar to dynload. Both  have
hashing schemes and create tables for loading functions. But why
isn't  bsd-dyna-link called bsd-dyna-load? When I think of dynamic
linking I think of the following example :

    Creating libF77.a and libI77.a via commands ld,
    mv, and ranlib in a makefile, and then in the statement

    gcc prog.c -lF77 -lI77 -lm -lc

    the executable file a.out only includes the executable
    code from libF77, libI77, libmath, and libc which is
    actually required about prog.c

This doesn't resemble bsd-dyna-link!

Finally, here is an excerpt from bsd-dyna-link. Does anyone know
whats going on?



main(argc, argv)
  char** argv;
  char* me = (char*) which(argv[0]);
  char* prog = (char*)(argv[1]);
  func_ptr tion;
  assoc_mem hash_tab;
  struct exec main_hdr;
  struct nlist * main_syms;

  int fd = open( me, O_RDONLY );

  lk_get_header(fd, &main_hdr, 0 );
  main_syms = lk_get_symbols(fd, &main_hdr, 0 );
  hash_tab = lk_sym_hash(&main_hdr, main_syms);

  { int times;
    int code;

    if(argc==2) times = 1;
      else times = atoi(argv[2]);

#       include <sys/time.h>
        struct timeval t1, t2;
        struct timezone tz;
        long usecs;
        gettimeofday(&t1, &tz);
        (func_ptr)tion = lk_dynaload( &code, &main_hdr, hash_tab, prog );
        gettimeofday(&t2, &tz);

        usecs =( t2.tv_sec - t1.tv_sec ) * 1000000 + t2.tv_usec - t1.tv_usec;
/*      fprintf(stderr, "%d %d %d\n", usecs, t2.tv_sec - t1.tv_sec,
                t2.tv_usec - t1.tv_usec);
            case lk_undefd:
              { char** undef = lk_undefined;
                while(*undef) printf("%s\n", *undef++);
            case lk_perror:
            case lk_bad_format:
              printf("bad format\n");


int xstderr;
int xfprintf;

kluge() { printf(); }

int comm_main;
int ext;
  fprintf(stderr, "(%x %x)foo be called.\n", stderr, fprintf);
  fprintf(stderr, "(%x %x) <<\n", xstderr, xfprintf);


#endif demo_dyna_link

Fri, 22 Dec 1995 13:36:56 GMT  
 [ 1 post ] 

 Relevant Pages 

1. invalid dynamic link call to .DLL file when loading MAX

2. scm4d2 has dynamic link/loading!

3. Doc: Win vs. Unix linking dynamic load modules

4. Dynamic linking or run time loading

5. TIP #100: Add Support for Unloading Dynamic Libraries Loaded with [load]

6. dynamic class hierarchies, dynamic changes to multimethods ?

7. Dynamic Timestamp in Dynamic SQL?

8. Dynamic web pages! not Dynamic HTML

9. Dynamic declaration of dynamic clauses?

10. Questions about dynamic loading

11. Dynamic DLL Loading in 32-Bit

12. LV 5.1 App Build and Dynamic Loading


Powered by phpBB® Forum Software