home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / msdos / programm / 11832 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.8 KB

  1. Path: sparky!uunet!mcsun!fuug!kiae!demos!newsserv
  2. From: Alex Yakovlev <yak@sms.ccas.msk.su>
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Problem in TopSpeed DOS Extender
  5. Date: Wed, 06 Jan 93 14:47:18 +0300
  6. Distribution: world
  7. Organization: Computing Center of Russian Academy of Sciences
  8. Message-ID: <Pn6RiIh4OX@sms.ccas.msk.su>
  9. Sender: news-service@newcom.kiae.su
  10. Reply-To: yak@sms.ccas.msk.su
  11. Lines: 48
  12.  
  13.  
  14.  Dear colleagues, we have the TopSpeed C/C++ System Ver 3.02
  15.  with TopSpeed DOS Extender - legal copy, don't worry. I use
  16.  dynamic link libraries (DLL), created by TopSpeed in extended
  17.  memory model (by the way, i've had to correct the system file
  18.  TSPRJ.TXT before i could create DLL's in this model - it's
  19.  obvious JPI's mistake!). When i attempted to use *MANUAL*
  20.  loading/unloading DLL's, i met serious problem. I've reduced
  21.  my program to the following pair of texts:
  22.  
  23.  My main text looks like as:
  24.  
  25.    #include <stdio.h>
  26.    #include <conio.h>
  27.    #include <tsxlib.h>
  28.    typedef unsigned (* Function) (void);
  29.    static Function func;
  30.    static unsigned handle, res;
  31.    void main (void)
  32.    {
  33.      while (getch() != 033)
  34.      {
  35.        handle = LOADMODULE("Drv");
  36.        func = (Function) GETPROCADDR("_Proc", handle);
  37.        res += func();
  38.        UNLOADMODULE(handle);
  39.        printf("%d\n", res);
  40.      }
  41.    }
  42.  
  43.  And DLL-text, named "Drv.c", is very simple:
  44.  
  45.    unsigned Proc(void) {return 1;}
  46.  
  47.  The main program results in General Protection Fault on the
  48.  15'th pass through the loop. I think, it is connected with an
  49.  incorrect behaviour of UNLOADMODULE. May be, it is necessary
  50.  to pass some other parameter, not a handle, into this
  51.  function?
  52.  
  53.  I'm sure, there are experienced people, who use TopSpeed DOS
  54.  Extender's DLL's in such a way. Help me, please!
  55.  --
  56.  Alex Yakovlev
  57.  Computing Center of Russian Academy of Sciences
  58.  Moscow, Russia
  59.  Internet: yak@sms.ccas.msk.su
  60.  
  61.