🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools
Article #466

VB and Watcom C/386 32 Bits DLL, Help !

#466
From: Jih-Chung Lee
Date: Tue, 10 Nov 1992 13:09
60 lines
1984 bytes
Hi,
  I intended  to call a 32 Bits DLL that Watcom C/386 created from VB, but
VB responsed with "Error in loading DLL". Since there was a message box DLL
created on screen. So I was quiet sure that the DLL had been loaded and 
executed by windows. My PC run Windows 3.1 ,VB 1.0 and Watcom 9.01/C386.
The following lines are Watcom command line, VB program and releated files.
any comments will be appreciated.


Watcom C9.01/386 compile, link, bind.

    wcc386 dll32 /zw
    wlink @dll32
    wbind dll32 -d -n

Visual Basic 1.0 program.

    Declare Function Win386LibEntry Lib "dll32.dll"  (ByVal a,ByVal b) As a Integer

    Sub Command1_Click()
       v = Win386LibEntry(1,1)
       text1.Text = Str$(v)
    Sub End

********* file dll32.c :  **********
/*
 *  DLL32.C
 */
#include <windows.h>    /* required for all Windows applications */
#include <dos.h>

int FAR PASCAL Lib1( WORD w1 )
{
  char buf[128];

  sprintf( buf, "Lib1: w1=%hx", w1);
  MessageBox( NULL, buf, "DLL32", MB_OK | MB_TASKMODAL );
  return( 2*w1);
}

int PASCAL WinMain( HANDLE hInstance, HANDLE x1, LPSTR lpCmdLine, int x2 )
{
  short i;
  char buf[128];

  DefineDLLEntry( 1, (void *) Lib1, DLL_WORD,DLL_ENDLIST);
  sprintf( buf, "DLL32 Started");
  MessageBox( NULL, buf, "DLL32", MB_OK | MB_TASKMODAL );
  return( 1 );
}

******* dll32.lnk ********
debug all
system win386
file dll32
option map
option stack=12K
option maxdata=8K
option mindata=4K
Technical Details
Message-ID: <1992Nov10.130927.19256@ccds3.ntu.edu.tw>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!jvnc.net!news.edu.tw!ccds3.ntu.edu.tw!ccms!d9502001

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!jvnc.net!news.edu.tw!ccds3.ntu.edu.tw!ccms!d9502001
From: d9502001@ccms.ntu.edu.tw (Jih-Chung Lee)
Newsgroups: comp.os.ms-windows.programmer.tools
Subject: VB and Watcom C/386 32 Bits DLL, Help !
Message-ID: <1992Nov10.130927.19256@ccds3.ntu.edu.tw>
Date: 10 Nov 92 13:09:27 GMT
Sender: usenet@ccds3.ntu.edu.tw (USENET PROXY ACCOUNT)
Organization: NTUTaiwan
Lines: 60
Nntp-Posting-Host: ccms.ntu.edu.tw
X-Newsreader: TIN [version 1.1 PL6]