Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Use VC++6.0 DLL in BC++5.2

Posted on 1999-06-30
Medium Priority
Last Modified: 2013-12-26
Is it possible to build DLL in VC++6.0 and make it accessible by BC++5.2? Could you provide an example?
Question by:468572
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 14

Expert Comment

ID: 1299141
Can ,it is possible. Dll is standart thing, and no matter
how you build it. But: Format of Debug information,
that can be in Dll is different in VC and BC.
This means, that you can't debug this Dll in symbol mode!
Example: standart example of using Dll ("SCPWDLL.DLL")

   const char szcScpWDLLName [] = "SCPWDLL.DLL"; //
   const char szcFuncName [] = "VERPROT";        //
   TModule  *ScpDLLModule;

   ScpDLLModule = new TModule ( szcScpWDLLName, TRUE);
   int FAR PASCAL ( *VerProtFun )( char * );
   ( FARPROC ) VerProtFun = ScpDLLModule ->
                      GetProcAddress ( szcFuncName );
   if ( VerProtFun )
   free (ScpDLLModule);

Author Comment

ID: 1299142
This doesn't work for me.
See following sample code.
//DLL built in VC++6.0
#include "stdafx.h"
#include "mydll.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;

#pragma data_seg("SharedMemory")
   int data = 0;
#pragma data_seg()

DLLexport void WINAPI IncrementCounter()
      char text[80];
      sprintf(text, "New counter value of %d.", ++data);

#if !defined(AFX_COUNTERDLL_H__A45E4A6E_A79A_11D1_887F_D42B07C10710__INCLUDED_)
#define AFX_COUNTERDLL_H__A45E4A6E_A79A_11D1_887F_D42B07C10710__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
      #error include 'stdafx.h' before including this file for PCH

#define DLLexport      __declspec( dllexport )
DLLexport void WINAPI IncrementCounter();

#endif // !defined(AFX_COUNTERDLL_H__A45E4A6E_A79A_11D1_887F_D42B07C10710__INCLUDED_)

//---the code I used in BC++5.2 to call the function in mydll.dll
          TModule  *ScpDLLModule = new TModule ( "mydll.dll", TRUE);
          void FAR PASCAL ( *entry )( void );
          ( FARPROC ) entry = ScpDLLModule ->GetProcAddress( "IncrementCounter" );
          if ( entry )
          free (ScpDLLModule);

I always get entry == NULL.

I also tried to use implib in BC5.2 to create mydll.lib and link it to my exe but I got "unresolved external 'IncrementCounter()' referenced from ......."

LVL 14

Expert Comment

ID: 1299143
By you data, after VC name of programm othen (not IncrementCounter). Can be "_" in Begin or case.
 For know this name you can use tdump programm,that
 print REAL exported name.
something as:
tdump mydll.dll my.lst


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 1299144
I have found the answer at the following inprise web site.
LVL 14

Expert Comment

ID: 1299145
468572! Thank for URL with this article, very interesting,
but may idea exectly as i think: VC generate name of Function other, than original. And I think, that best
way is not make def files, as in anm article, but(as i wrote)
1.use tdump for detect REAL name.
2. Use this real name in line
          ( FARPROC ) entry = ScpDLLModule ->GetProcAddress( "@IncrementCounter32" );
//for example
Best Regards, Alex
LVL 14

Accepted Solution

AlexVirochovsky earned 100 total points
ID: 1299146
468572, you must or cancel you Q or accept my Reply,
becouse, as i think, discussion is over!

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question