Hi,
I'm having awful trouble trying to build a simple dll that Win32::API can
access. I have version 0.53 of Win32::API, and perl-5.10.0 (built from
source using the same (commercial version of) Visual Studio 7.0 compiler
that I'm using to build the dll.
Here's one of the things that I've tried:
--- integer.h --
int my_int(int);
----------------
--- integer.c --
#include "integer.h"
int my_int(int x) {
return x / 7;
}
----------------
Build the dll (with __stdcall calling convention):
----------------
C:\_32\c>cl /Gz /LD integer.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.00.9466 for 80x86
Copyright (C) Microsoft Corporation 1984-2001. All rights reserved.
integer.c
Microsoft (R) Incremental Linker Version 7.00.9466
Copyright (C) Microsoft Corporation. All rights reserved.
/out:integer.dll
/dll
/implib:integer.lib
integer.obj
C:\_32\c>
----------------
Write a script to access the dll's my_int function:
-- integer.pl --
use Win32::API;
use warnings;
$function = Win32::API->new('integer', 'my_int', 'N', 'N');
if(!$function) {print $^E, "\n"}
$ret = $function->Call(123);
print $ret, "\n";
----------------
Run integer.pl:
----------------
C:\_32\c>perl integer.pl
The specified procedure could not be found
Can't call method "Call" on an undefined value at integer.pl line 6.
C:\_32\c>
----------------
What am I missing ?
Does integer.dll need to export the my_int function ?
It doesn't export any symbols at all, so I've also tried building with
__declspec(dllexport). The dll then exports '_my_int' (which has a leading
underscore) and the output of running integer.pl remains unchanged.
Cheers,
Rob
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs