tags:

views:

51

answers:

1

I've got a 3rd party C application that's compiled to a non-.NET non-COM DLL. It has one simple function declared like so:

Declare Function CapiTaxRoutine Lib "taxcommono.dll" (ByVal sInData As String, ByVal OutputData As String, ByVal intINPutLength As Long) As Integer

If I place the taxcommono.dll in my path (C:\Windows\System32 is what I'm using because it's what the vendor recommends), I can wire up a call to the function and it works just fine. It returns a 1 or 0 for success/failure, but it also sets the value of the OutputData string parameter (using some C pointer magic I'm not familiar with) to a huge fixed width format return record that has the data I need. When I call it from a .NET .exe application, it works just fine. When I try to call it from an ASP.NET application via a referenced compiled .NET wrapper DLL, it runs but can't set that string. In order to get it to run, I can't have taxcommono.dll in my path, but rather have to place it in my Bin directory of the web project. Does anyone know of a reason it can set the pointer when called from an .exe application but not when called from a web app?
The .NET wrapper DLL I'm using works when called from our ERP software, which is not web based. But when I add a reference to that same DLL in the web app, it won't give me that output value. I'm stumped. It doesn't help that I've never really worked with C pointers before and am used to just getting a return value instead of a function setting the value of one of my input parameters. I find it weird.

A: 

So not sure why it wouldn't work from a referenced DLL, but when I installed the wrapper DLL in the GAC, it worked for me. Which is also the same way I got it to work when called from the ERP software. One HUGE caveat is if you're running 64 bit windows and the non-.NET, non-COM DLL referenced by the wrapper is 32 bit, it needs to live in Windows\SysWOW64, not Windows\System32. Very counter-intuitive. This cost me more time than the main problem.

fr0man