LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default XLL Internittently Fails to Load

I have a very simple XLL which I am trying to load in Excel 2007 on Windows
Vista. I have found that the problem occurs also in Excel 2003 on Vista, but
not in 2007 on XP. More accurately, this problem is not 100% consistent, but
occurs dramatically more often under Vista than under XP. Version of Excel
does not seem to matter.

When loading the XLL, I get a "The file you are trying to open,
'test_addxll.xll', is in a different format than specified by the file
extension." error. Having used Dependency Walker to profile Excel while
loading, I see that the sequence of events is as follows:
Excel loads without resolving dependencies test_addxll.xll.
Excel unloads test_addxll.xll.
Excel loads without resolving dependencies test_addxll.xll.
Excel checks for XlAutoOpen in test_addxll.xll.
Excel unloads test_addxll.xll.
Excel loads without resolving dependencies test_addxll.xll.
Excel unloads test_addxll.xll.
Excel loads without resolving dependencies test_addxll.xll.
Excel checks for XlAutoOpen in test_addxll.xll.
Excel unloads test_addxll.xll.
Excel loads test_addxll.xll.
DllMain in test_addxll.xll is called.
test_addxll.xll is unloaded.
LoadLibrary returns NULL, reporting an Invalid access to memory location
(998) error.
Specifically,
LoadLibraryW ("C:\Users\rich\Documents\Calc4Web\test_addxll.xll ") called
from "EXCEL.EXE" at address 0x2FF08667.
Loaded "TEST_ADDXLL.XLL" at address 0x03440000. Successfully hooked module.
DllMain (0x03440000, DLL_PROCESS_ATTACH, 0x00000000) in "TEST_ADDXLL.XLL"
called.
Unloaded "TEST_ADDXLL.XLL" at address 0x03440000.
LoadLibraryW (C:\Users\rich\Documents\Calc4Web\test_addxll.xll" ) returned
NULL. Error: Invalid access to memory location (998).

This seems to indicate that an access violation is occurring inside DllMain.
However, the DllMain is this:
BOOL WINAPI DllMain (HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
{

switch (dwReason)
{
case DLL_PROCESS_ATTACH:
break;

case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

Further, while this error occurs consistently when the XLL is compiled using
the MinGW toolkit (gcc 3.4.2, dlltool 2.16.91, dllwrap 2.16.91), I have not
been able to produce the error if I compile the XLL using Visual Studio (98,
2003, or 2005). Additionally, by using a fake XLCALL32.DLL file that does
not require Excel to be running, I was able to successfully load the XLL in a
standalone C++ program (compiled with Visual Studio 2005).

With more complex examples (the XLL statically linked to a DLL file
statically linked to another DLL file, all compiled with MinGW), the same
failure can occur, typically in one of the two DLL files. The same DLL files
could be accessed via standalone C++ or VB6, but trying to access them via VB
inside Excel failed much as loading the XLL fails. The problem only occurs
when the library is loaded from within Excel.

Again this problem does not occur when the XLL is compiled with Visual C++,
but I need to be able to generate working add-ins using MinGW as well as
using Visual C++.

Does anybody have experience with a problem like this, or information on
what we might do to solve it? If needed, I should be able to provide the
XLL, the code for the XLL, and a Dependency Walker profile.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering Fails RussellT Excel Discussion (Misc queries) 1 October 31st 09 12:17 AM
Custom 2 axis chart saved as template fails to load ALV Charts and Charting in Excel 0 December 5th 07 09:02 PM
Set name fails Oldjay Excel Programming 3 May 11th 07 09:59 AM
XLL loading fails unless load through File Open msdn_groupie Excel Programming 0 May 7th 07 06:56 PM
Code fails if ran more than once Christy Excel Programming 11 August 31st 05 06:57 PM


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"