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
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
from: Greg Goebel / HP-MXD
gvg@lvld.hp.com / 970-679-3030 / FAX 970-679-5971
to: VRf
date: Thursday, 23 January 1997 1416 MST
One of our lab people responds on this:
> 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.
-------
|
------------------------------+
This is the old 'trying to use a 16-bit dll in 32-bit land'
problem. 3.2 & later need 32-bit dll's
[<>] regards -- gvg