home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18891 < prev    next >
Encoding:
Internet Message Format  |  1992-12-25  |  1.9 KB

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