calling/loading c++ dll

  • Thread starter Martin Huseby Karlsen
  • Start date
M

Martin Huseby Karlsen

I made a dll in c++ to do some calculations, and i call it from vba ( for
excel XP, also tried it fro access and excel 2000)

Problem is that when i copy the dll to another PC and run the same vba code
i get "run time error 53, dll file not found", on the pc where the dll i
created everything works nice

I've tried to register the dll with regsvr32 and from the vba code, with
"regsvr32 myDll.dll" i get the error "the specified module could not be
found"

I used a "MFC DLL " project in visual studio .net to create the dll, in
basic i followed this example
http://civilu.ce.utexas.edu/stu/goodaljl/c++VBA.htm

Any ideas of what i should do to make the dll run nice on other pc's than
the one the dll i created on ?
 
D

David Lowndes

I made a dll in c++ to do some calculations, and i call it from vba ( for
excel XP, also tried it fro access and excel 2000)

Problem is that when i copy the dll to another PC and run the same vba code
i get "run time error 53, dll file not found", on the pc where the dll i
created everything works nice

Martin,

Your DLL will depend on others that you probably don't have on the
other PC. Use the Depends utility (www.dependencywalker.com) on the
DLL (on the other PC) to find what's missing.

Dave
 
L

Lars-Eric Gisslén

Martin,

If you followed the steps in the link you provided you created a normal DLL
(Dynamic Link Library) with a list of exported functions. Regsvr32 does not
work with plain DLL's as they don't have the function called by RegSvr32 for
registring itself (DllRegisterServer) and is not using the OLE system. You
will need the Declare Function... statement in your VBA code and you should
install the DLL in the default path for that computer, like \WinNT,
\WinNT\System32 directory. When Windows loads a DLL (without a path
specified) it searches for the DLL in the following order; 1, the directory
the application is running from. 2, the current directory, 3, the System
directory. 4, the Windows directory. 5, directories that are listed in the
PATH environment variable. Your DLL should be installed in one of these
directories. I have not been working with VC++ 7 but if some of the runtime
DLL's in VC++ 7 is different from those in VC++ 6 you must also install
those DLL's on the target computer.

Regards,
Lars-Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top