in reply to Call a function from DLL
I suspect nothing is wrong with your import: the error Undefined subroutine &main::Print refers to your statement Print($return); infact in perl you have print not Print and no parens are needed (or you'll get another error like print interpreted as function at.. ).
Also do not never forget to use strict; use warnings; at the top of your perl programs.
As per the Win32::API docs is good to check if the import was done (the two die in the below code):
use Win32::API; $function = Win32::API::More->new( 'mydll', 'int sum_integers(int a, int b)' ); #### $^E is non-Cygwin only die "Error: $^E" if ! $function; #### or on Cygwin and non-Cygwin die "Error: ".(Win32::FormatMessage(Win32::GetLastError())) if ! $func +tion;
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Call a function from DLL
by Cleware (Novice) on Jul 15, 2019 at 07:49 UTC | |
by GrandFather (Saint) on Jul 15, 2019 at 08:18 UTC | |
by Cleware (Novice) on Jul 15, 2019 at 10:24 UTC | |
by GrandFather (Saint) on Jul 16, 2019 at 00:51 UTC | |
by holli (Abbot) on Jul 15, 2019 at 08:45 UTC |