Skip to content

Instantly share code, notes, and snippets.

View auterium's full-sized avatar

Marc Enriquez auterium

View GitHub Profile
@auterium
auterium / fn_cb.rs
Created January 5, 2020 16:07
PG Function callback wrapper draft
use pg_extend::pg_sys;
use std::{ffi::c_void, ptr};
type PGCallback = unsafe extern "C" fn(arg: *mut c_void);
pub struct FunctionCallbackWrapper {
fn_mcxt: pg_sys::MemoryContext,
}
impl FunctionCallbackWrapper {
@auterium
auterium / lib.rs
Last active January 4, 2020 21:38
PG function with callback
#[macro_use]
extern crate lazy_static;
use libloading::os::windows::{Library, Symbol};
use pg_extend::pg_magic;
use pg_extend::pg_sys::{self, Pg_finfo_record};
use pg_extern_attr::pg_extern;
use std::os::raw::c_void;
lazy_static! {