“Error in loading DLL" error

I have a web agent in forms6.nsf. When I try to call a function from a dll in this agent, I get the error “Error in loading DLL". I have the dll both in Windows system directory and Domino directory. I tried putting the dll in Domino/Data/iNotes directory, I tried specifying the full path in Declare statement but nothing helps. Any idea? Here is the Declare statement.
Declare Function TestInitialize Lib "c:\winnt\system32\test.dll" Alias "TestInitialize" ( Byval val1 As String, Byval  val2 As Integer, Byval val3 As Integer, Byval val4 As Integer ) As Integer
Thanks.
RPrabhaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mbonaciCommented:
It seems that dll can be found but maybe the function inside the dll isn't exported the right way or not at all?
RPrabhaAuthor Commented:
I can call the same function from a form that is in user’s mail database. So, I think that there is no problem with dll.
SysExpertCommented:
So it works fine on a Client, but not on the Server ?

Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

RPrabhaAuthor Commented:
Well, I would say that..
It works on Notes Client when it is called from the lotus script that is executed on click of a button.
It does not work on ‘Domino Web Access’ when it is called from a lotus script web agent that is triggered on click of a button.
In both the cases, the database resides on the server.
Please let me know, if my answer is not clear.
SysExpertCommented:
IS the DLL local in each case, or is it also on the server ?

Web related buttns may require that the DLL be on the server. I have not tested this, but remember erading i somewhere.

I hope this helps !
ZvonkoSystems architectCommented:
First of all, remove the directory prefix in front of the dll name:  c:\winnt\system32\
That path is for sure in the path search order.
Also if you use some other directories, the print them out for test, because backslash is an escape character.
Check for this: c:\\winnt\\system32\\
Then check Agent execution rights.
Sjef BosmanGroupware ConsultantCommented:
Backslash is escape character in Formula language, not in LotusScript. Anyway, remove the path.

Does the DLL work from a test program in C, i.e. outside the Domino environment?
RPrabhaAuthor Commented:
The dll is in the server and it works outside Domino environment. I can't figure out what is wrong with my dll but I created another one from the scratch and it works. I did not have to give the full path but put it in the windows system directory. It is strange that my original dll does not work. Thank you all for the response.
ZvonkoSystems architectCommented:
You are welcome.
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.