32-bit loadlibrary of opcapi.dll fails on win64 - error 193 (234 Views)
Reply
Occasional Visitor
tmilner
Posts: 3
Registered: ‎10-27-2008
Message 1 of 4 (234 Views)

32-bit loadlibrary of opcapi.dll fails on win64 - error 193

I'm running .NET 2 in 32-bit mode (x86) trying to loadlibrary for opcapi.dll on Microsoft Server 2003 x64 SP2. I'm using HP BTO software A.8.50.51. This code runs on win32, but fails to load w/ the DLL on win64.

loadlibrary 193 seems to indicate that the 32-bit DLL is bad. Anyone have any solutions?

Tom
Please use plain text.
Honored Contributor
Drew Dimmick
Posts: 8,053
Registered: ‎11-16-2002
Message 2 of 4 (234 Views)

Re: 32-bit loadlibrary of opcapi.dll fails on win64 - error 193

you can't call 32 bit dll's from 64 bit codes or vice-versa. I suspect you're running the native 64 bit agent, you'll need to load that from a 64 bit process.

The better way is to call the automation object (see the examples directory) to send a message - the entire opcapi.dll is implemented as a com object.
I do "Windows"
Please use plain text.
Occasional Visitor
tmilner
Posts: 3
Registered: ‎10-27-2008
Message 3 of 4 (234 Views)

Re: 32-bit loadlibrary of opcapi.dll fails on win64 - error 193

Drew,

Thanks for the thought, but my code is compiled w/ the x86 CPU option (for 32-bit), and it installs into file path "C:\Program Files (x86)\...". I'm merely trying to port to a Win64 system. The HP BTP software supports both a 32-bit & 64-bit versions of opcapi.dll on win64.

When I compile with the "AnyCpu" (64-bit on win64) option, I can link to the 64-bit opcapi.dll, but other parts of our product require that we stay in 32-bit mode.

So, the big question is "Why can't I load the 32-bit version of opcapi.dll?". The error 193 implies HP shipped a bad library. Am I missing something? The same code works on a 32-bit windows w/ BTO software. Any other ideas?

-Tom
Please use plain text.
Occasional Visitor
tmilner
Posts: 3
Registered: ‎10-27-2008
Message 4 of 4 (234 Views)

Re: 32-bit loadlibrary of opcapi.dll fails on win64 - error 193

Geez, I've forgotten computers 101.

The problem/solution is simple. There is no reference in the PATH variable to the 32-bit libraries... so my 32-bit app always tries to bind to the 64 bit versions. Duh. Sometimes its the simple things.

Tom
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation