[pgrouting-dev] Using pfree/palloc in c++ code.
Dave Potts
dave.potts at pinan.co.uk
Wed Aug 14 15:19:50 PDT 2013
I am trying to write some code in c++
Its suggested that I should pfree/pmalloc to delete and free memory.
Problem is that when I use them, I get an error from the loader
select pgr_sql_check_tsp('select * from edge4');
ERROR: could not load library
"/usr/lib/postgresql/9.1/lib/librouting_tsp.so":
/usr/lib/postgresql/9.1/lib/librouting_tsp.so: undefined symbol:
_Z18MemoryContextAllocP17MemoryContextDatam
atsp=#
It looks like a name mangling issue
I tried inserting extern "C" statments around the postgres include files
(palloc.h) in my code because I discovered that, postgres source does
not do this, results same issue.
I noticed that ./src/apsp_warshall/src/apsp_boost_wrapper.cpp, has an
instance of pfree commented out, is there a reasons for this?
Does anybody known
1. Is it possible to use pfree/palloc in a potgres cpp file?
2. Can I use new/malloc/delete etc instead of pfree/palloc
regards
Dave.
More information about the pgrouting-dev
mailing list