Arijeet
06-02-2010, 10:51 AM
Hi,
I have 2 .dlls in C++ which I am calling from VBA in Excel.
One is MyStDll.dll, a very light-wight dll with 1 exported function only.
The other is a heavy sgwindll.dll, which calls many other dlls.
The way I am calling them from my VBA code is:
Private Declare Function AddLongs_Pointer Lib
"c:\sgw\MyStDll\Debug\MyStDll.dll" _
(FirstElement As Long, ByVal lElements As Long) As Long
Private Declare Function AddLongs_Pointer Lib
"c:\sgw\test1\Debug\sgwindll.dll" _
(FirstElement() As Long, lSum As Long) As Long
The problem is with the loading of the sgwindll.dll
I can put the MyStDll.dll in any location and as long as I give the correct path after Lib, VBA is able to load the dll and execute the function operation.
But, in case of the sgwindll.dll, I have to place it in the same directory as EXCEL.EXE. In case I put the sgwindll.dll (and all required dlls) in a different location, I get Error 48: Error in loading DLL.
Am I missing something? Please help.
I have 2 .dlls in C++ which I am calling from VBA in Excel.
One is MyStDll.dll, a very light-wight dll with 1 exported function only.
The other is a heavy sgwindll.dll, which calls many other dlls.
The way I am calling them from my VBA code is:
Private Declare Function AddLongs_Pointer Lib
"c:\sgw\MyStDll\Debug\MyStDll.dll" _
(FirstElement As Long, ByVal lElements As Long) As Long
Private Declare Function AddLongs_Pointer Lib
"c:\sgw\test1\Debug\sgwindll.dll" _
(FirstElement() As Long, lSum As Long) As Long
The problem is with the loading of the sgwindll.dll
I can put the MyStDll.dll in any location and as long as I give the correct path after Lib, VBA is able to load the dll and execute the function operation.
But, in case of the sgwindll.dll, I have to place it in the same directory as EXCEL.EXE. In case I put the sgwindll.dll (and all required dlls) in a different location, I get Error 48: Error in loading DLL.
Am I missing something? Please help.