Calling 32-bit DLL's built with Borland C++ from non-BC Apps
Currently, Borland C++ supports calling a DLL compiled with Borland C++ from
applications created with other tools only if they are dynamically bound to the
DLL. This is achieved by the application calling LoadLibrary at run-time to load
the DLL and then calling GetProcAddress to retrieve the entry points for the
functions exported from the DLL.
Static binding is not supported. From a C or C++ application, static binding is
achieved by linking import records (either import libraries or entries in the
IMPORTS section of the application's Module Definition File) to the calling
application. Using Delphi 2.0, static binding is achieved using a declaration
such as:
function Foo(parm: Integer): Integer; stdcall; external 'my.dll' name 'Foo';
You can use either C++ or Structured Exception Handling in the DLL. For best
results, exceptions should be caught within the scope of the DLL throwing the
exception. If the calling application is built with Borland C++, Delphi or
Microsoft Visual C++, the exception can be caught in the application calling the
DLL; however, Visual Basic does not seem to have an exception handlng syntax.
To create an EH-compatible 32-bit DLL, just replace the default startup code,
c0d32.obj for 32-bit DLL's, with c0d32dyn.obj and re-link the DLL. Using
command-line tools, the startup code is the first object module specified to
Tlink32. Using the Integrated Development Environment, select Options |
Environment | Project View and check Show run-time nodes. In the project window,
there will now be displayed entries for the startup module and all the libraries
which are automatically linked in depending on your target. Remove the node for
the startup code, c0d32.obj, and add c0d32dyn.obj in its place.
			
		
 
	
Partager