CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Win32::API chokes on .NET dependency

 



aaronmj
New User

Apr 25, 2014, 9:44 AM

Post #1 of 6 (9405 views)
Win32::API chokes on .NET dependency Can't Post

I have a C DLL that provides an external interface to my software. I've been creating examples in various languages, and I'd like to add one for Perl.

The problem that I am running into is that my DLL loads a .NET class library. When that happens the program crashes out with an unhandled .NET exception because it can't locate the library file. All of the files are in the same directory so I don't know why it is not being found.

Any suggestions?


FishMonger
Veteran / Moderator

Apr 25, 2014, 10:16 AM

Post #2 of 6 (9402 views)
Re: [aaronmj] Win32::API chokes on .NET dependency [In reply to] Can't Post

So, the perl script is able to call your dll function, but that function needs to load a .NET library to do its work but fails to load that library.

To me that indicates that your dll function needs some additional work.

Is it possible that the dll function expects a particular environment and that your "examples" in the other languages were setting that up but the perl script isn't?


aaronmj
New User

Apr 25, 2014, 11:16 AM

Post #3 of 6 (9400 views)
Re: [FishMonger] Win32::API chokes on .NET dependency [In reply to] Can't Post

I'm thinking it is some kind of environment issue--like a dll search path. I don't have any idea where that might be, though.

These are really, REALLY trivial examples I'm building; on the order of 10 lines. There's nothing at all being set up in the other examples. My user base is not likely to have much coding experience, so I'm just trying to give them a boilerplate to build off of.


FishMonger
Veteran / Moderator

Apr 25, 2014, 11:36 AM

Post #4 of 6 (9397 views)
Re: [aaronmj] Win32::API chokes on .NET dependency [In reply to] Can't Post

Environment settings in perl are stored in the %ENV hash. If you need to adjust the path environment, you would modify the value of $ENV{PATH}.

Besides modifying existing environment settings, you can also add/delete environment items via the %ENV hash.


(This post was edited by FishMonger on Apr 25, 2014, 11:37 AM)


aaronmj
New User

Apr 28, 2014, 7:10 AM

Post #5 of 6 (8763 views)
Re: [FishMonger] Win32::API chokes on .NET dependency [In reply to] Can't Post

The path variable doesn't seem to be the issue. It contains all the right locations. I tried concatenating the application directory to the path, but that didn't help.


FishMonger
Veteran / Moderator

Apr 28, 2014, 8:12 AM

Post #6 of 6 (8740 views)
Re: [aaronmj] Win32::API chokes on .NET dependency [In reply to] Can't Post

I think you need to focus your troubleshooting on your DLL function(s).


Quote
the program crashes out with an unhandled .NET exception

That error is telling you that you need to add additional error handling in the dll function. After adding that additional error handling, you may get a more descriptive message pointing to the source of the problem.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives