Creation of a DLL containing classes in BC 4.52
Posted on 1997-04-28
I am working on a large project for Windows 3.1 16 bits. With time, I have been forced to reduce my stack more and more up to the point I couldn't do it anymore. So now I HAVE to make a DLL. It's a first for me and I am having a little trouble with it. Here's what happens:
Borland ++ version 4.52
- Target type :
Dynamic Library [.dll]
Windows 3.xx (16)
-Target model :
-Standard library :
In the IDE projet I delete the files .DEF and the .RC
In dll.cpp :
class _MYCLASS MyClass0
_MYCLASS is defined with
#define _MYCLASS __export
#define _MYCLASS __import
In the project options creating the DLL, I define "BUILD_MY_DLL" and USES_MY_DLL in the project using the DLL
C++ compile doesn't have any problem
If I compile too many classes while editing the link, an extra dialog box appears while running BC45\BIN\IMPLIB.DLL.
It says "Critical error during transfer". The compilation is then stopped without error.
The problem disppears if I don't include too many classes in a module. But, if I create an other module using #include,
the problem reappears with no solution...
This method works on 3 classes. The DLL uses up 80 Kb. It's impossible
to add any more classes to end up with a DLL of over 300 Kb, for example.
If I create another project using the classes from the first, I can only define 2 classes and the second DLL only uses 60 Kb, which means it's actually smaller than the first one.
I did not define any int FAR PASCAL LibMain(HINSTANCE,WORD,WORD,LPSTR) in the dll ...
I used impdef to declare classes in the .DEF but there was no change.
How to create a DLL without being penalised by this error?
Are there examples of IDE projects of DLL containing numerous classes?
Is there an upper limit of the number of classes in a DLL?
Sometimes I also get the following error while editing the link:
"Linker fatal : Unable to open file 'C:\BC45\LIB\c0dl.obj'"
But this file exists and is not corrupted...
So, in the end, I can have a big DLL but since implib crashes, I get a .LIB of 0 byte.