?
Solved

.DLL file created in C++ yields error message

Posted on 2002-06-26
9
Medium Priority
?
262 Views
Last Modified: 2010-05-02
We are using a .dll file created in C++ and placed in the System32 directory.   When called from ACCESS VBA it yields the following error message:

         "Bad DLL Calling Convention"

  We are unable to get a handle on why this is happening or what we must do to change it.
0
Comment
Question by:FidelMike
[X]
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
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 18

Expert Comment

by:deighton
ID: 7110561
what are the parameters for the .dll?

Are strings involved?
0
 
LVL 18

Expert Comment

by:deighton
ID: 7110615
how are you declaring the call to the api?
0
 

Author Comment

by:FidelMike
ID: 7110735

Here is how I am declaring this .dll for this particular function.

Declare Function PSL_Connect Lib "PSL_ApiR.dll" _
                            (ByVal ServiceName As String, _
                             ByVal Server As String, _
                             ByVal Port As Long) As Long
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
rpai earned 400 total points
ID: 7110758
I believe the default convention in C++ is  __cdecl. VB only supports calling functions in dlls that are declared with the __stdcall calling convention. Try declaring your dlls function as __stdcall.
Hope that helps.
0
 

Author Comment

by:FidelMike
ID: 7110802
VB will not accept the "_" character.  How can we create the .dll in order to keep the naming convention that we are calling in VBA?  Can this be done?

  Declare Function PSL_Connect Lib "PSL_ApiR.dll" _
                           (ByVal ServiceName As String, _
                            ByVal Server As String, _
                            ByVal Port As Long) As Long

  We need the .DLL to name this function internally the way shown above.
0
 
LVL 5

Expert Comment

by:rpai
ID: 7110848
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7111323
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7963112
Hi FidelMike,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rpai's comment(s) as an answer.

FidelMike, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8039241
Per recommendation, force-accepted.

Netminder
EE Admin
0

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

718 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