|
| |
User Groups : Forums : SiteExperts : The Server
:  | Classic ASP Calling VB DLL that calls VC++ DLL Need some big favor here.
Two scenarios, one works, the other doesn't.
Scenario one: VB6 EXE using CreateObject("MY_VBDLL.MY_CLASS") which in turn uses Declare Function MY_C_FUNC Lib "MY_VCDLL.DLL"... blablabla. Works fine.
Scenario two: ASP using CreateObject("MY_VBDLL.MY_CLASS") which in turn uses Declare Function MY_C_FUNC Lib "MY_VCDLL.DLL"... blablabla. Error '800a0035' File not found: MY_VCDLL.DLL
Note that logic or structure in bolded text are exactly the same, yet in Scene 2 I get this error that does not make any sense.
Reason that I think does not make sense:
1. Everything is there. Scene 1 proves that all code workds, and proves correct register of the VB DLL. ALL files involved (ASP, VB6 DLL, VC++ DLL) reside in the same directory.
2. I've used Dependency Walker to peek into the VC++ DLL and made sure the dependency files are there. (I am not a VC++ developer)
3. I've tried modifying the Lib part within the "Declare Function" statement, using either just the DLL file's name, with or without extension, plus the full absolute path to the VC++ DLL. Same results: Scene 1 works, not Scene 2.
4. I've tried setting the environments PATH and added the directory which contained all those files above. No success.
5. I've tried moving all the DLLs into system32, system32\inetsrv... No success.
6. I've googled and have failed to find even the simplest example as I have, nor have I have straight resolved answers to this issue.
Environment(s)
XP running IIS 5.1 Vista Home Premium running IIS 7.0 Server-side language: Classic ASP
ASP / VB EXE Code
<% Dim c, lng Set c = CreateObject("MY_VBDLL.MY_CLASS") lng = c.DoThis("00000000000000000001") '------------- Dies on this line Response.Write lng ' or MsgBox lng for the case of VB EXE Code %>
MY_VBDLL.MY_CLASS Code
Option Explicit
Private Declare Function DoThat Lib "MY_VCDLL.DLL" Alias "_XXXXXXXXXX@4" (ByVal IN_szString As String) As Long
Public Function DoThis(ByVal IN_szString As String) DoThis = DoThat(IN_szString) End Function
MY_VCDLL.DLL
(Unknown, not controlled by me, but Scene 1 confirms that it works)
ASP Error
MY_VBDLL Error '800a0035'
File not found: MY_VCDLL.DLL
/DEFAULT.ASP, Line 3
Note on Error
As I have mentioned that I have also tried using a full absolute path referring to the VC++ DLL, and same error appears, showing me the full path of the DLL which EXISTS, yet stating "File not found", which is complete non-sense.
Question and rant
Has anybody got this to work? I mean calling a VC++ function from a VB6 Class from an ASP page?
Like always, I find Microsoft's error messages completely unhelpful for debugging.
Need some advise from someone who actually experienced this type of call and got it to work: What am I missing here?
Started By Terry Young on Sep 1, 2010 at 6:45:14 PM |  | | 10 Response(s) | Reply |
| View All Replies | Goto Page: 2 1 |  | | ChrisRickard on Sep 4, 2010 at 12:57:26 AM I've done this many times before... It should work. My guess is the most likely culprit is permissions.
Whenever Declare XXX is used to a c dll a Win32 LoadLibrary call is invoked which searches the exe directory (for w3wp or inetinfo) and the Path Environment variable.
Since you tried both these in #4 and #5 I would venture to guess that LoadLibrary is failing because of *something* and the error is translated as a generic "File Not Found" because that's the most common error. The account on behalf of IIS might have privileges to load that dll.
If you want to send me what you have to rickard234@gmail.com I can take a look and try to repro/fix it.
| | View All Replies | Goto Page: 2 1 |
To respond to a discussion, you must first logon.
If you are not registered, please register yourself to become a member of the SiteExperts.community.
|