Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write DLL to call DLL function

Status
Not open for further replies.

therishel

Programmer
Apr 13, 2004
5
US
I am working in a proprietary 4GL that has very specific requirements for compatibility with DLL's. I have received a DLL from a vendor that is fine, but that does not conform to the compatiblity requirements of my 4GL. I want to write a "wrapper" DLL that conforms to the compatibility requirements and calls a function from the DLL provided by the vendor. I am using the free Borland command line compiler. When I try to compile my DLL I get Unresolved External <vendor DLL function name> . . .

It seems that the compiler does not know how to link to the library when it is referenced from inside a function.

Here is some sample code:

#include <windows.h>
#include <EXPINTFC.H>

int FAR PASCAL _export 4GL_DLL(char* InputParm)
{
VendorFunction(InputParm, 0);
return 0;
}

In this sample, 4GL_DLL is my "wrapper" and VendorFunction is the function provided in the library from the vendor.

Thanks.

Tom
 
Depends on which version of VS you are using.
V6 right click on project, select Settings...
V7/V8 right click on project, select Properties
Earlier versions I haven't got a clue

Anyway, assuming you have V6, select the link tab. Select input from the combo. Add the lib file that comes with your dll to the list of input objects

Try that and see how you get on.
 
Thanks for the reply, but I am on the command line compiler. Not V6, V7, V8, or any of those. In the command line compiler linking is managed by a switch passed as part of the compile command. Alternatively, you can write a configuration (.cfg) file and put your options in that. I have used the configuration file option. The odd thing is that, when I change the name of my function to main() and compile it as an .exe it works fine. I think the compiler is choking because it doesn't know how to manage the DLL inside a DLL structure. If I can get my hands on the source of the vendor DLL I can just edit it and be done. Anyway, I have given up on this approach and am pursuing other avenues. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top