Skip Menu |

This queue is for tickets about the Win32-API CPAN distribution.

Report information
The Basics
Id: 42694
Status: rejected
Priority: 0/
Queue: Win32-API

People
Owner: Nobody in particular
Requestors: msjuniorc [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.58
Fixed in: (no value)



Subject: Callback and Structs
Cosimo, I am currently writing a Win32::Video::Capture module making calls to avicap32.dll. Several "messages" require the use of "structs" and "callbacks". Thank to the "callback3.pl" example in the sample directory, it was clear how to use nested structs in a callback environment. Unfortunately both in my own code and the aforementioned example I encure repetitive errors: "Attempt to free unreferenced scalar". More details in the logs below. At the current time and in order to proceed without the Win32::API::Struct, I am using the Win32::API::Callback and a few calls to the "RtlMoveMemory" and "lstrcpy" functions of the kernel32.dll. Although this work without any issues, I have to say the approach lacks the "elegance & readability" that the use of Win32::API::Struct would give. It seems that there might be an "extra" call to a "sv_2mortal" in the XS portion. Is there anything i can do on my end to help? Thank you in advance, Giuseppe "Jr." Some extra data: 1) I have used Win32::API::Struct in "normal" calls (i.e. not callbacks) without issues. 2) I am using Win32::API::Callback without Win32::API::Struct (via "RtlMoveMemory" and "lstrcpy") without issues. 3) AS Perl, v5.10.0 built for MSWin32-x86-multi-thread. === Output of my module === [Thu Jan 22 17:05:30 2009] FrameCallBack hwnd: 0X250766 HWND: 2426726 LPVIDEOHDR length: 40 ============================================================ DEBUG(lpData): 263520264 DEBUG(dwBufferLength): 230400 DEBUG(dwBytesUsed): 230400 DEBUG(dwTimeCaptured): 0 DEBUG(dwUser): 0 DEBUG(dwFlags): 8 Attempt to free unreferenced scalar: SV 0x1a79fb4, Perl interpreter: 0x24604c at (eval 8) line 2. [Thu Jan 22 17:05:32 2009] FrameCallBack hwnd: 0X250766 HWND: 2426726 LPVIDEOHDR length: 40 ============================================================ DEBUG(lpData): 263520264 DEBUG(dwBufferLength): 230400 DEBUG(dwBytesUsed): 230400 DEBUG(dwTimeCaptured): 0 DEBUG(dwUser): 0 DEBUG(dwFlags): 8 Attempt to free unreferenced scalar: SV 0x1a7a0f4, Perl interpreter: 0x24604c at (eval 8) line 2. [Thu Jan 22 17:05:34 2009] FrameCallBack hwnd: 0X250766 HWND: 2426726 LPVIDEOHDR length: 40 ============================================================ DEBUG(lpData): 263520264 DEBUG(dwBufferLength): 230400 DEBUG(dwBytesUsed): 230400 DEBUG(dwTimeCaptured): 0 DEBUG(dwUser): 0 DEBUG(dwFlags): 8 Attempt to free unreferenced scalar: SV 0x1a7b264, Perl interpreter: 0x24604c at (eval 8) line 2. [Thu Jan 22 17:05:36 2009] FrameCallBack hwnd: 0X250766 HWND: 2426726 LPVIDEOHDR length: 40 ============================================================ DEBUG(lpData): 263520264 DEBUG(dwBufferLength): 230400 DEBUG(dwBytesUsed): 230400 DEBUG(dwTimeCaptured): 0 DEBUG(dwUser): 0 DEBUG(dwFlags): 8 === OUTPUT of callback3.pl === LPELF.lfFaceName = 'Arial' Attempt to free unreferenced scalar: SV 0x19ac0dc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19ae0b4, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CE' Attempt to free unreferenced scalar: SV 0x19ae134, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19ae6b4, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CYR' Attempt to free unreferenced scalar: SV 0x19ae734, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b332c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Greek' Attempt to free unreferenced scalar: SV 0x19b33ac, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b392c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial TUR' Attempt to free unreferenced scalar: SV 0x19b39ac, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b3f2c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Baltic' Attempt to free unreferenced scalar: SV 0x19b3fac, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b6d5c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial' Attempt to free unreferenced scalar: SV 0x19b6ddc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b735c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CE' Attempt to free unreferenced scalar: SV 0x19b73dc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b795c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CYR' Attempt to free unreferenced scalar: SV 0x19b79dc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b9094, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Greek' Attempt to free unreferenced scalar: SV 0x19b9114, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19b9694, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial TUR' Attempt to free unreferenced scalar: SV 0x19b9714, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19bc22c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Baltic' Attempt to free unreferenced scalar: SV 0x19bc2ac, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19bc82c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial' Attempt to free unreferenced scalar: SV 0x19bc8ac, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19bce2c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CE' Attempt to free unreferenced scalar: SV 0x19bceac, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19bfb7c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CYR' Attempt to free unreferenced scalar: SV 0x19bfbfc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c017c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Greek' Attempt to free unreferenced scalar: SV 0x19c01fc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c077c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial TUR' Attempt to free unreferenced scalar: SV 0x19c07fc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c1ec4, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Baltic' Attempt to free unreferenced scalar: SV 0x19c1f44, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c24c4, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial' Attempt to free unreferenced scalar: SV 0x19c2544, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c607c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CE' Attempt to free unreferenced scalar: SV 0x19c60fc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c667c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial CYR' Attempt to free unreferenced scalar: SV 0x19c66fc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c6c7c, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Greek' Attempt to free unreferenced scalar: SV 0x19c6cfc, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c98c4, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial TUR' Attempt to free unreferenced scalar: SV 0x19c9944, Perl interpreter: 0x243b34 at (eval 4) line 2. Attempt to free unreferenced scalar: SV 0x19c9ec4, Perl interpreter: 0x243b34 at (eval 4) line 2. LPELF.lfFaceName = 'Arial Baltic' everything is fine. Attempt to free unreferenced scalar: SV 0x19c9f44, Perl interpreter: 0x243b34. Attempt to free unreferenced scalar: SV 0x19ca4c4, Perl interpreter: 0x243b34.
On Thu Jan 22 21:13:41 2009, juniorc wrote: Show quoted text
> Cosimo, > > I am currently writing a Win32::Video::Capture module making calls to > avicap32.dll. Several "messages" require the use of "structs" and > "callbacks". Thank to the "callback3.pl" example in the sample > directory, it was clear how to use nested structs in a callback > environment. Unfortunately both in my own code and the aforementioned > example I encure repetitive errors: "Attempt to free unreferenced > scalar". More details in the logs below. > At the current time and in order to proceed without the > Win32::API::Struct, I am using the Win32::API::Callback and a few calls > to the "RtlMoveMemory" and "lstrcpy" functions of the kernel32.dll. > Although this work without any issues, I have to say the approach lacks > the "elegance & readability" that the use of Win32::API::Struct would > give. It seems that there might be an "extra" call to a "sv_2mortal" in > the XS portion. Is there anything i can do on my end to help? > > Thank you in advance, > > Giuseppe "Jr."
Can you try the latest CPAN version of Win32::API (0.72) and report how it works for you?
On Fri Oct 19 04:19:35 2012, BULKDD wrote: Show quoted text
> On Thu Jan 22 21:13:41 2009, juniorc wrote:
> > Cosimo, > > > > I am currently writing a Win32::Video::Capture module making calls to > > avicap32.dll. Several "messages" require the use of "structs" and > > "callbacks". Thank to the "callback3.pl" example in the sample > > directory, it was clear how to use nested structs in a callback > > environment. Unfortunately both in my own code and the aforementioned > > example I encure repetitive errors: "Attempt to free unreferenced > > scalar". More details in the logs below. > > At the current time and in order to proceed without the > > Win32::API::Struct, I am using the Win32::API::Callback and a few calls > > to the "RtlMoveMemory" and "lstrcpy" functions of the kernel32.dll. > > Although this work without any issues, I have to say the approach lacks > > the "elegance & readability" that the use of Win32::API::Struct would > > give. It seems that there might be an "extra" call to a "sv_2mortal" in > > the XS portion. Is there anything i can do on my end to help? > > > > Thank you in advance, > > > > Giuseppe "Jr."
> > Can you try the latest CPAN version of Win32::API (0.72) and report how > it works for you?
Try 2. The current version is 0.74 on CPAN.
On Tue Jan 08 22:57:15 2013, BULKDD wrote: Show quoted text
> On Fri Oct 19 04:19:35 2012, BULKDD wrote:
> > On Thu Jan 22 21:13:41 2009, juniorc wrote:
> > > Cosimo, > > > > > > I am currently writing a Win32::Video::Capture module making calls to > > > avicap32.dll. Several "messages" require the use of "structs" and > > > "callbacks". Thank to the "callback3.pl" example in the sample > > > directory, it was clear how to use nested structs in a callback > > > environment. Unfortunately both in my own code and the aforementioned > > > example I encure repetitive errors: "Attempt to free unreferenced > > > scalar". More details in the logs below. > > > At the current time and in order to proceed without the > > > Win32::API::Struct, I am using the Win32::API::Callback and a few
calls Show quoted text
> > > to the "RtlMoveMemory" and "lstrcpy" functions of the kernel32.dll. > > > Although this work without any issues, I have to say the approach
lacks Show quoted text
> > > the "elegance & readability" that the use of Win32::API::Struct would > > > give. It seems that there might be an "extra" call to a
"sv_2mortal" in Show quoted text
> > > the XS portion. Is there anything i can do on my end to help? > > > > > > Thank you in advance, > > > > > > Giuseppe "Jr."
> > > > Can you try the latest CPAN version of Win32::API (0.72) and report how > > it works for you?
> > Try 2. The current version is 0.74 on CPAN.
Closing no response. Struct got some improvements and bug fixes in 2012, so maybe one of them would have fixed the problems claimed by the OP.