Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 38 lines (28 sloc) 0.75 kb
15d93b1 @kthakore MultiTheadPOC.pl added. It shows quickly how we can use Inline::C to …
kthakore authored
1 use Inline C => DATA =>
2 LIBS => `sdl-config --libs` =>
3 INC => `sdl-config --cflags`;
4
5 my $fp = get_function_pointer();
6 print '[Perl] In perl we got :'.$fp."\n";
7 print '[Perl] Making Thread.';
8
9 make_thread( $fp, 'I AM THE OVERLOARD XENU!!!');
10
11 __END__
12 __C__
13
14 #include <SDL.h>
15 #include <SDL_thread.h>
16
17 char DoIt(char* c){
18 int threadID = SDL_ThreadID();
19 printf("[C-Thread] we are in %d \n", &threadID);
20 printf("[C-Thread] Called with %s \n", c);
21 return c;
22 }
23
24 int get_function_pointer() {
25 printf("[C] Function Pointer is at %d!\n", &DoIt);
26 return PTR2IV(&DoIt);
27 }
28
29
30 int make_thread(IV pointer, char* c)
31 {
32 void * fp = INT2PTR( void *, pointer);
33 void * data = c;
34 SDL_CreateThread( fp, data );
35 printf("[C] Created thread: \n");
36 }
37
Something went wrong with that request. Please try again.