home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5477 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.5 KB  |  102 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!pipex!bnr.co.uk!bnrgate!nott!torn!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!kth.se!nada.kth.se!da1-lst
  3. From: da1-lst@nada.kth.se (Lars-Erik Stenholm)
  4. Subject: SUPERBASE/BC++/DLL
  5. Message-ID: <1993Jan28.152137.8561@kth.se>
  6. Originator: da1-lst@hemul.nada.kth.se
  7. Sender: usenet@kth.se (Usenet)
  8. Nntp-Posting-Host: hemul.nada.kth.se
  9. Reply-To: da1-lst@nada.kth.se (Lars-Erik Stenholm)
  10. Organization: Royal Institute of Technology, Stockholm, Sweden
  11. Date: Thu, 28 Jan 1993 15:21:37 GMT
  12. Lines: 88
  13.  
  14. Posted for a friend of mine...
  15. __________________________________________________________________
  16.  
  17. To users of Superbase 4 and Borland C++:
  18.  
  19. I'm having problems trying to call a DLL (wich I write with Borland C++),
  20. from a Superbase 4 DML program. My test example is very easy. My DLL just
  21. returns a string. The following is the code of the C++ program that creates
  22.  
  23. the DLL:
  24.  
  25. #include <stdlib.h>
  26. #include <owl.h>
  27. #include "windows.h"
  28.  
  29. PTModule DLLHelloLib;
  30.  
  31. extern "C"
  32. {
  33.   char * far mystring();
  34. };
  35.  
  36. char * far _export mystring() {
  37.         return "Hello Superbase I'm coming from a DLL!!!";
  38. };
  39.  
  40.  
  41.  
  42. int FAR PASCAL LibMain(HINSTANCE hInstance, WORD, WORD, LPSTR lpCmdLine)
  43. {
  44.     int TheStatus;
  45.  
  46.     DLLHelloLib = new TModule("DLLHello", hInstance, lpCmdLine);
  47.     TheStatus = DLLHelloLib->Status;
  48.     if ( TheStatus != 0 )
  49.     {
  50.       delete DLLHelloLib;
  51.       DLLHelloLib = NULL;
  52.     }
  53.     return (TheStatus == 0);
  54. }
  55.  
  56. int FAR PASCAL WEP ( int)
  57. {
  58.     return 1;
  59. }
  60.  
  61.  
  62.  
  63. My compilation opptions are:
  64. Applications options: Windows DLL
  65. Model: Large
  66. Defines: _CLASSDLL; STRICT; WIN31
  67. Entry/Exit code: Window DLL explicit functions exported
  68.  
  69. My .DEF file for compiling the DLL is:
  70.  
  71. LIBRARY DLLHELLO
  72. DESCRIPTION     'DLL Hello'
  73. EXETYPE WINDOWS
  74. CODE PRELOAD MOVEABLE DISCARDABLE
  75. DATA PRELOAD MOVEABLE SINGLE
  76. HEAPSIZE 1024
  77. EXPORTS mystring
  78.  
  79. If I call the function mystring from another C program that I have
  80. linked with the DLL import library, it works, I get then string from
  81. DLL. But I don't get it I call the function from my superbase program
  82. wich looks like this:
  83.  
  84. REGISTER CLEAR
  85. REGISTER "hellodll.dll","mystring","C"
  86. a$ = CALL("mystring")
  87. ?a$
  88. REGISTER CLEAR
  89.  
  90. The message that I get is:
  91. mystring can't find function
  92.  
  93.  
  94. If someone have some idea what is missing or what I'm doing wrong I would be
  95. very glad to know it. Thank you very much for all kind of help!!!!
  96.  
  97. Plese respond with e-mail to jorge@cor.sos.sll.se
  98.  
  99. Thanks in advance!
  100.  
  101. Jorge Cantini
  102.