|
-
May 16th, 1999, 10:56 PM
#1
Using VC++ generated DLLs in Borland C++ 5.0
Hi All,
I'm trying to create DLL in VC++ 6.0 with the follwing spec :
extern "C"
{
int _pascal _export MyFunc(char *szSomeData);
}
Since VC++ environment doesn't support _pascal or _export keywords any more, I cannot compile my project.
I'm using these keywords because one of our application was written in Borland C++ and I must use the above DLL with it.
Brief : Can I create a DLL / LIB in VC++ that can be used in BC++ environment.
Please do help me in this.
Thanks in advance.
-
May 17th, 1999, 04:55 AM
#2
Re: Using VC++ generated DLLs in Borland C++ 5.0
Use the PASCAL and EXPORT keywords instead.
-
May 18th, 1999, 02:33 AM
#3
Re: Using VC++ generated DLLs in Borland C++ 5.0
Hi Cheng,
Thank you.
I tried to use PASCAL and EXPORT keywords, but that doesn't work either.
Specifically, I can't use EXPORT keyword. Please suggest.
Best regards,
Rajesh
-
May 21st, 1999, 11:43 PM
#4
Re: Using VC++ generated DLLs in Borland C++ 5.0
I used these keywords as following:
extern "C" BOOL PASCAL EXPORT DrawInit(int* nX,int* nY)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState()); //if you use MFC
}
Add the function name to the EXPORTS section of the .def file.
It works well.I don't know what your matter really is, so I can't give you any more valuable
ideas.
-
May 22nd, 1999, 05:17 PM
#5
Re: Using VC++ generated DLLs in Borland C++ 5.0
Try this :
extern "C"
{
int _stdcall __declspec(dllexport) MyFunc(char *szSomeData);
}
-
May 22nd, 1999, 05:21 PM
#6
Re: Using VC++ generated DLLs in Borland C++ 5.0
Try this :
extern "C"
{
int _stdcall __declspec(dllexport) MyFunc(char *szSomeData);
}
This will export as _MyFunc@4 unless you use a .def file
If you use a header file to give the appropriate prototype
you shouldn't have a problem.
-
May 23rd, 1999, 03:19 AM
#7
Re: Using VC++ generated DLLs in Borland C++ 5.0
You are not defining the exported function correctly. The _export keyword is not used in a 32-bit environment. That's why VC++ ignores it.
If you are building a 32-bit DLL, there should be no problem in defining the functions as this:
#ifdef DLL
#define FUNCDEF __declspec( dllexport ) __stdcall
#else
#define FUNCDEF __stdcall
#endif
extern "C" {
BOOL FUNCDEF MyFunc(int);
}
This works in both Borland and Microsoft. Just define the DLL symbol if you are compiling the DLL.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|