error: 453 - Can't find dll entry point


Using VC++ 2010 Express
I am creating a dll to export a simple Multiply function so I can use it in Excel/VBA

These e are the steps I am following :

. Create a Win32 C++ Project and give a name. For example: CallDllFromVBA
. Select the DLL option in the Wizard and click Finish
. In the CPP file (here CallDllFromVBA.cpp), add the following code

1
2
3
4
5
#include "stdafx.h"
int _stdcall Multiply(int x, int y)
{
 return x * y;
}



. Add a .def file and add the following contents
LIBRARY CallDllFromVBA
EXPORTS
Multiply
. Build the project

The Build output show everything is ok as follows :

1
2
3
  CallDllFromVBA.cpp
  CallDllFromVBA.vcxproj -> c:\documents and settings\administrateur\mes documents\visual studio 2010\Projects\CallDllFromVBA\Debug\CallDllFromVBA.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========



In VBA, I insert a module and add the following code:
1
2
3
4
5
6
7
Declare Function Multiply Lib _
"c:\documents and settings\administrateur\mes documents\visual studio 2010\Projects\CallDllFromVBA\Debug\CallDllFromVBA.dll" _
(ByVal x As Long, ByVal y As Long) As Long

Sub test()
    MsgBox Multiply(2, 4)
End Sub


When I run the Test sub I get the error: 453 - Can't find dll entry point

I also opened the CallDllFromVBA dll with Dependency walker and I can't find the Multiply export function - In fact, the dependency walker doesn't show any function exports at all for the CallDllFromVBA dll !

Any thoughts what the problem might be ?

Thanks

Last edited on
Bump ... Anyone ?
You know how regular binary files need a function titled "int main()" and Windows binary files need to have an "int WinMain(...)"? Unlike a script, a compiled binary file runs more or less independently of the order that the code was written in. But in order for that to work properly, the files need to have a standardized place to start. This is called the entry point. For DLL files, that entry point is titled "DLLMain". Here is what you need to get started: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583(v=vs.85).aspx

EDIT: Also you need to export your function.
Last edited on
Topic archived. No new replies allowed.