Re: Re: [SQL] g++ not working for postgresql extension languages?
От | Lonnie Cumberland |
---|---|
Тема | Re: Re: [SQL] g++ not working for postgresql extension languages? |
Дата | |
Msg-id | 20010415182011.1844.qmail@web12508.mail.yahoo.com обсуждение исходный текст |
Ответ на | Re: [SQL] g++ not working for postgresql extension languages? (Stephen Jackson <Stephen.Jackson@panting-deer.org.uk>) |
Ответы |
Re: Re: [SQL] g++ not working for postgresql extension
languages?
(Peter Eisentraut <peter_e@gmx.net>)
|
Список | pgsql-interfaces |
Hello All, I have gotten the EXTERN "C" statement to work with the simple test c++ functions, but I cannot get it to work with the my actual crypto4.0 c++ sources which I am able to compile all together into a single funcs.so file. I am getting no errors but when I go into the "psql trdata" and try the same test then I get this error: [root@Treazurac /test]# psql trdata Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit trdata=# select concat_text('a','d'); ERROR: Load of file /test/trfuncs.so failed: /test/trfuncs.so: undefined symbol: MemoryContextAlloc__FP17MemoryContextDataUi ----------------------------------------------------------------------------- I do not know what is going on here because I did a simple test without my cyrpto4.0 c++ files and using 3 different copies of concat_text(), concat1_text() and concat2_text() which compiled and even ran fine. now when I put in my other sources which compile correctly outside of Postgresql, I get the above error. I have zipped up the test files and will send them to someone if you would like to take a quick look. Just let me know as I am at a loss as to why PostgreSQL is having som much trouble with this C++ interface. Cheers Lonnie --- Stephen Jackson <Stephen.Jackson@panting-deer.org.uk> wrote: > Lonnie, > > C++ uses "name mangling" to permit overloading of functions. Therefore > your function concat_text() ends up with a very different name. You can > probably get round this as follows: > > #ifdef __cplusplus > extern "C" { > #endif > text * > concat_text(text *arg1, text *arg2); > #ifdef __cplusplus > } > #endif > > This tells the C++ compiler that concat_text is a "C" name - so don't do > name mangling. This is a common technique for making C++ code callable > from C, although I haven't used it in the specific context you are > using. > > Hope this helps, > > Stephen Jackson > Home: Stephen.Jackson@panting-deer.org.uk www.panting-deer.org.uk > Work: Stephen.Jackson@looksystems.co.uk www.looksystems.co.uk > > Lonnie Cumberland wrote: > > > > Hi All again, > > > > One more thing that I have tried. > > > > If I now do a similar thing as in my previous message with the "funcs.c" > file, > > but this time with the "funcs.cc" file then I can get: > > > > [snip] > > > > > trdata=# select concat_text('a','b'); > > ERROR: Can't find function concat_text in file /test/funcs.so > > trdata=# > > -------------------------------------------------------------------------- > > > > [snip] > > > > > text * > > concat_text(text *arg1, text *arg2); > > > > [snip] > > > so now I do not understand why the "gcc" version works and the "g++" > version > > does not? > > > > Just a side note in that I can easliy compile c++ the examples in the > > interfaces/libpq++ directory without any problems so that this is very > strange > > to me. > > > > I really need the "g++" version to work correctly as well? > > > > Any ideas anyone? > > > > Cheers > > Lonnie > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
В списке pgsql-interfaces по дате отправления:
Предыдущее
От: Stephen JacksonДата:
Сообщение: Re: [SQL] g++ not working for postgresql extension languages?
Следующее
От: Peter EisentrautДата:
Сообщение: Re: Re: [SQL] g++ not working for postgresql extension languages?