Skip to content
This repository
Browse code

added C helper code

  • Loading branch information...
commit 0269db57f60b578eb30e426680528b71f1303e8c 1 parent f342267
Tobias Leich FROGGS authored

Showing 2 changed files with 30 additions and 0 deletions. Show diff stats Hide diff stats

  1. +11 0 lib/SDL/CompileTestLib.pm
  2. +19 0 lib/SDL/memcopy.c
11 lib/SDL/CompileTestLib.pm
... ... @@ -0,0 +1,11 @@
  1 +module SDL::CompileTestLib;
  2 +
  3 +sub compile_test_lib( $name ) is export {
  4 + my $o = $*VM<config><o>;
  5 + my $so = $*VM<config><load_ext>;
  6 + my $c_line = "$*VM<config><cc> -c $*VM<config><cc_shared> $*VM<config><cc_o_out>$name$o $*VM<config><ccflags> $name.c";
  7 + my $l_line = "$*VM<config><ld> $*VM<config><ld_load_flags> $*VM<config><ldflags> " ~
  8 + "$*VM<config><libs> $*VM<config><ld_out>$name$so $name$o";
  9 + shell($c_line);
  10 + shell($l_line);
  11 +}
19 lib/SDL/memcopy.c
... ... @@ -0,0 +1,19 @@
  1 +#include <string.h>
  2 +
  3 +#ifdef WIN32
  4 +#define DLLEXPORT __declspec(dllexport)
  5 +#else
  6 +#define DLLEXPORT extern
  7 +#endif
  8 +
  9 +DLLEXPORT void *GetBuf( const void *from, void *to, size_t len )
  10 +{
  11 + return memcpy( to, from, len );
  12 +}
  13 +
  14 +DLLEXPORT void *GetPointer( size_t len )
  15 +{
  16 + return (void *)len;
  17 +}
  18 +
  19 +

0 comments on commit 0269db5

Please sign in to comment.
Something went wrong with that request. Please try again.