Click to See Complete Forum and Search --> : error: bad calling dll convention


GetFree
September 5th, 2001, 04:54 PM
hi you all doing

i have a dll defined like this in access module

Public Declare Function GenerateLicenceID Lib "C:\Final\bin\vproc.dll" Alias "?GenerateLicenceID@@YA?AVCString@@V1@H@Z" (sBaseID As String, duration As Integer) As String


than i have a function that calls it in one of the forms

Dim SerKey As String
Dim UnKey As String
Dim sTerm As Integer

sTerm = [Term].Value
SerKey = [Lic_Key].Value

UnKey = GenerateLicenceID(SerKey, sTerm)

[Unlock_Key].Value = UnKey

but as i run it i get bad calling dll convention

i use the alias feature because that is how it is called after exporting it in c++

berta
September 5th, 2001, 07:29 PM
1) R U sure as string the return value of API?
2) maybe that the function in lib is not declare as __stdcall...

<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/images/bertaplanet.gif'>
</center>

ryu
March 21st, 2006, 10:03 PM
YES!!! This post has helped me solved my problem. I forgot to put __stdcall after declspec(dllexport).

Thanks GetFree :)

Bornish
March 21st, 2006, 10:41 PM
Warning If you change the function name, class, calling convention, return type, or any parameter, the decorated name is no longer valid. You must get the new version of the function name and use it everywhere the decorated name is specified."?GenerateLicenceID@@YA?AVCString@@V1@H@Z" is not guaranteed to remain the same. To get your function exported with an undecorated name you should use a *.def file in the C++ project building the dll.
Sample content of a *.def file:; MyDLL.def
; The LIBRARY entry must be same as the name of your DLL

LIBRARY "MyDLL"
DESCRIPTION "What is my library doing"

EXPORTS
VisibleName1
VisibleName2=InternalName2
VisibleName3 @1
VisibleName4 @2 NONAMERegards,