Skip Menu |

This queue is for tickets about the Devel-CheckLib CPAN distribution.

Report information
The Basics
Id: 61645
Status: new
Priority: 0/
Queue: Devel-CheckLib

Owner: Nobody in particular
Requestors: TONYC [...]

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

Subject: no way to define extra functions for use in test code
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1285463789-24877-117"
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 480
Download (untitled) / with headers
text/plain 480b
Devel::CheckLib allows a function parameter which can be used to supply the body for the main function, which is useful for testing the library. Unfortunately this doesn't allow testing where: - the library API accepts function pointer for callbacks - the library API defines macros for headers to be included For example with libfreetype, your C code starts out something like: #include <ft2build.h> #include FT_FREETYPE_H Attached, a patch that adds a prologue parameter.
Subject: checklib-prologue.diff
MIME-Version: 1.0
Content-Type: text/x-diff; name="checklib-prologue.diff"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="checklib-prologue.diff"
Content-Transfer-Encoding: binary
Content-Length: 939
Index: Devel/ =================================================================== --- Devel/ (revision 1833) +++ Devel/ (working copy) @@ -138,6 +138,23 @@ =back +If you need to perform know more than "does it link?" you can provide +code to be compiled and run: + +=over + +=item function + +the body of the <main()> function. If not provided C<return 0;> is +used. + +=item prologue + +code to insert between the C<#include> of the headers and the +definition of main. + +=back + =head2 check_lib_or_exit This behaves exactly the same as C<assert_lib()> except that instead of @@ -281,6 +298,7 @@ 'assertlibXXXXXXXX', SUFFIX => '.c' ); print $ch qq{#include <$_>\n} foreach (@headers); + print $ch "\n$args{prologue}\n" if $args{prologue}; print $ch "int main(void) { ".($args{function} || 'return 0;')." }\n"; close($ch); for my $link_cfg ( @link_cfgs ) {

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to