Hi Monks
I've been trying to write a user defined dll in C so that I can call the functions contained within the dll in my Perl program. I have used Win32::API with little trouble on existing Windows functions such as FindWindow or SendMessage, but I cannot get any basic C function to call correctly when I create the dll myself. I get a GPF every time when I attempt to call it thus: -
(From the event log)
Faulting application perl.exe, version 5.8.7.815, faulting module perl58.dll, version 5.8.7.815, fault address 0x000606b7.
I'm using Windows XP Pro sp2 with ActiveState Perl 5.8.7.
The dll is created using Visual Studio 6 sp6.
My code snippet:
The function simply takes an integer and returns it, simple as that (you would think).
use strict;<br>
use diagnostics;<br><br>
use Win32::API;<br><br>
my $func = Win32::API->new ('C:\func.dll', 'myFunc',['I'], ['I']) or d
+ie "Can't make a Win32::API object!";<br><br>
print "ReturnCode = ", $func->Call(100);<br>
------
Any help with this will be greatly appreciated.
Regards
Ant
Edit: g0n closed code tag
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.