You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've installed FFI::TinyCC and wrote the following code:
use FFI::Platypus 1.00;
use FFI::TinyCC;
my $tcc = FFI::TinyCC->new();
$tcc->detect_sysinclude_path();
$tcc->add_library('ssl');
$tcc->add_library('crypto');
$tcc->compile_string(q!
#include <openssl/bio.h>
BIO *create_bio_buffer(const char *string) {
BIO* bio = BIO_new_mem_buf( string, -1 );
return bio;
}
!);
my $ffi = FFI::Platypus->new();
my $address = $tcc->get_symbol('create_bio_buffer');
$ffi->attach( [ $address => 'create_bio_buffer' ] => ['string'] => 'opaque' );
my $bio_buf = create_bio_buffer('hello world');
This dies with an empty string as the error. The $tcc->{'error'} is empty, so the exception object is empty. The entire error string is empty because as_string adds a newline to it.
If I try to use $tcc->set_options('-lcrypto -lssl') I get:
tcc: error: undefined symbol 'BIO_new_mem_buf'
tcc: error: '_etext' defined twice
tcc: error: '_edata' defined twice
tcc: error: '_end' defined twice
tcc: error: '__preinit_array_start' defined twice
tcc: error: '__preinit_array_end' defined twice
tcc: error: '__init_array_start' defined twice
tcc: error: '__init_array_end' defined twice
tcc: error: '__fini_array_start' defined twice
tcc: error: '__fini_array_end' defined twice
If I try tcc directly, it does work, which is why I'm thinking the add_library and set_options themselves don't work right:
/.../Alien-TinyCC/bin/tcc -I/.../Alien-TinyCC/lib/tcc/include/ -I/usr/include -lcrypto -lssl -c -shared foo.c -o foo.so
# then use Platypus::FFI with foo.so as expected
The text was updated successfully, but these errors were encountered:
Hrm. I think we just pass these functions directly to libtcc so we might not be able to do anything about it. I will investigate further though. As a workaround FFI::CheckLib combined with add file would allow you to do the same without having to provide the full paths:
That's what I ended up doing. I should've updated the ticket with that info. Sorry.
no problem, I just wanted to make the suggested in case this was blocking you. I still want to just make sure there isn't anything we can't do in this module, but probably won't be able to investigate more closely until after TPC.
I've installed
FFI::TinyCC
and wrote the following code:This dies with an empty string as the error. The
$tcc->{'error'}
is empty, so the exception object is empty. The entire error string is empty becauseas_string
adds a newline to it.If I try to use
$tcc->set_options('-lcrypto -lssl')
I get:Which shows it didn't link the libraries.
However, this works:
If I try
tcc
directly, it does work, which is why I'm thinking theadd_library
andset_options
themselves don't work right:The text was updated successfully, but these errors were encountered: