AnsweredAssumed Answered

VRf-Need_DLL_help

Question asked by VRFuser on Jan 23, 1997
Hi VEE Reflector,

I am trying to write a very simple DLL to run from  inside VEE.  All the
parts compile successfully, but VEE complains - "Cannot load dll" in the
"Import Library" object.  What am I doing wrong here????
I am using Borland C++ 5.0 on a Pentium PC running Windows95, VEE 3.21.
Below are copies of my test_lib.cpp, test_lib.def, td.h, test_dll.mak.  I
use td.h as the definition file for the "Import Library".  To run the make
file I type in - make -B -DWIN16 -ftest_dll.
Any help is appreciated.


***** test_dll.cpp

#define STRICT
#define WIN16
#include <windows.h>
#include <conio.h>
#pragma argsused

extern "C" {
int FAR PASCAL LibMain(HINSTANCE, WORD, WORD, LPSTR);
int FAR PASCAL WEP (int);
long FAR CDECL MYFUNC(long);
}


  int FAR PASCAL LibMain (HINSTANCE hInstance, WORD wDataSeg, WORD
wHeapSize, LPSTR lpszCmdLine)
  {
  return 1;
  }

  int FAR PASCAL WEP (int nParameter)
  {
  return 1;
  }


long FAR CDECL MYFUNC(long A)
{
return (A*2);
}


***** test_dll.def

LIBRARY TEST_DLL

DESCRIPTION 'TEST_DLL'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 10000


EXPORTS     _MYFUNC

***** td.h

# td.h file for VEE
long MYFUNC(long A)

***** test_dll.mak

# test_dll.MAK

BCROOT = $(MAKEDIR)..
INCPATH= $(BCROOT)INCLUDE
LIBPATH= $(BCROOT)LIB
PATHS  = -I$(INCPATH) -L$(LIBPATH)

COMPILER = BCC.EXE
RCCOMPILER = BRC.EXE
DLLFLAGS = -ml -R -WD -2 -v  -wpro -weas -wpre

APPNAME = test_dll
OBJS = test_dll.obj

# goal
ALL: $(APPNAME).dll

# link DLLS
test_dll.dll: test_dll.obj test_dll.def
  $(COMPILER) $(DLLFLAGS) $(PATHS) test_dll.obj

# compile
test_dll.obj: test_dll.cpp td.h
  $(COMPILER) -c $(DLLFLAGS) $(PATHS) test_dll.cpp

# resource
$(APPNAME).res: $(APPNAME).rc
  $(RCCOMPILER) -r -I$(INCPATH) $(APPNAME).rc


Thanks,

Sandra Koppen
NASA Langley Research Center
Hampton, VA
s.v.koppen@larc.nasa.gov
(757) 8646209
Sandra Koppen
s.v.koppen@larc.nasa.gov


Outcomes