Hello Guys,

I have a DLL created using Borland C++ 6, I need to use the same DLL with VC++ 2008, I have the .DLL and .LIB files created by Borland and the header file exporting 2 functions that I need to use in my program (Header file looks like this):

#ifndef ChaidInterfaceH
#define ChaidInterfaceH
//--------------------------------------------------------------------------

#ifdef __cplusplus /* if in a C++ program */
  extern "C"
#endif

void __declspec(dllimport) WINAPI chiprobLib(double, int, double &);
float __declspec(dllimport) WINAPI fisprobLib(float, int, int);

#endif

Can any body tell how to use this DLL in my VC++ program and how to modify my Header file?

Recommended Answers

All 5 Replies

you should not have to modify that header file. Just add that header file to the *.cpp program's includes, call the functions, and tell the compiler what *.lib file to use. You could use a pragma to do that in the *.cpp file #pragma comment(lib, "mylib.lib"); or add it to the project settings.

you should not have to modify that header file. Just add that header file to the *.cpp program's includes, call the functions, and tell the compiler what *.lib file to use. You could use a pragma to do that in the *.cpp file #pragma comment(lib, "mylib.lib"); or add it to the project settings.

Thanks Ancient for replying,

I did that already I got errors in my ChaidInterfaceH
file like this:

chaidinterface.h(16) : error C2146: syntax error : missing ';' before identifier 'chiprobLib'
chaidinterface.h(16) : error C2182: 'WINAPI' : illegal use of type 'void'
chaidinterface.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chaidinterface.h(17) : error C2146: syntax error : missing ';' before identifier 'fisprobLib'
chaidinterface.h(17) : error C2371: 'WINAPI' : redefinition; different basic types
chaidinterface.h(16) : see declaration of 'WINAPI'
chaidinterface.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I have been reading about this issue, it is saying that the .LIB file generarted by BorlandC++ is not the same, and cannot be used is VC++, meaning that I have to create a VC++ version of the .LIB file !!

The errors you posted are compile-time errors, not link errors. So that lib files have not been processed yet.

did you include windows.h before including that header file?

#include <windows.h>
#include "ChaidInterface.h"
...

The errors you posted are compile-time errors, not link errors. So that lib files have not been processed yet.

did you include windows.h before including that header file?

#include <windows.h>
#include "ChaidInterface.h"
...

I added <windows.h> now I get a Link error as follows:

chaidlib.lib : fatal error LNK1136: invalid or corrupt file

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.