Board index » cppbuilder » VC DLL's and BCB

VC DLL's and BCB

Hi!
Can anybody tell me what a function declaration in VC should look like
to be able to
import it into a BCB application ?
I have tried this:
extern "C" __declspec(dllexport) BOOL __stdcall MBCGetStatus( PUCHAR St
)
{
    ...
Quote
}

Using implib and declaring the function like this in BCB:
extern "C" __declspec(dllimport) BOOL __stdcall _MBCGetStatus( PUCHAR St
);
The application links ok, but when running it I get: Unable to find
_MBCGetStatus in dll...
Anybody out there that can give me some ideas ?
Regards,
Jan Ove Halvorsen
 

Re:VC DLL's and BCB


On Tue, 01 Sep 1998 10:03:23 +0200, Jan Ove Halvorsen

Quote
<Jan.Ove.Halvor...@hatteland.com> wrote:
>Hi!
>Can anybody tell me what a function declaration in VC should look like
>to be able to
>import it into a BCB application ?
>I have tried this:
>extern "C" __declspec(dllexport) BOOL __stdcall MBCGetStatus( PUCHAR St
>)
>{
>    ...
>}
>Using implib and declaring the function like this in BCB:
>extern "C" __declspec(dllimport) BOOL __stdcall _MBCGetStatus( PUCHAR St
>);
>The application links ok, but when running it I get: Unable to find
>_MBCGetStatus in dll...
>Anybody out there that can give me some ideas ?

VC++ and BCB have different symbol decorations for __stdcall (MS is the one
going against the grain on this one).  If you look at the DLL, you will
probably see the symbol
        _MBCGetStatus@4
which is the way that VC++ decorates __stdcall symbols.  BCB (and most other
compilers) makes the symbol look like
        MBCGetStatus

So, you ask, what do you do?  Run IMPDEF on the DLL.  Now edit the .DEF
file, and change the line that has _MBCGetStatus@4 to look like
        MBCGetStatus=_MBCGetStatus@4
which creates an alias.  Now run IMPLIB on the DEF, which will create a BCB
import library.  Add the LIB to your project, and voila, you're up and
running...

+----------------------------------------------------------------------+
| Jody Hagins                                                          |
| Automated Trading Desk            "Fame is a vapor, popularity is an |
| 389 Johnnie Dodds Blvd, Su. 200   accident, and money takes wings.   |
| Mt. Pleasant, SC  29464           The only thing that endures is     |
| j...@atdesk.com                   character."                        |
|                                        - O.J. Simpson, 1979          |
+----------------------------------------------------------------------+

Re:VC DLL's and BCB


Quote
> Can anybody tell me what a function declaration in VC should look like
> to be able to
> import it into a BCB application ?

A couple of pages that are "Must See" for using VC++ DLLs:

http://www.pacifier.com/~jgibbon/program_tip_4.html
http://www.borland.com/devsupport/bcppbuilder/qna/qnaspage.html

+===================================================+
| Jonathan Arnold (mailto:jdarn...@buddydog.org)    |
| Senior Engineer           Roger Wagner Publishing |
| http://people.ne.mediaone.net/jdarnold            |
+===================================================+

"In order to keep a true perspective of one's importance, everyone
 should have a dog that will worship him and a cat that will ignore
 him." -- Dereke Bruce

Other Threads