New project: creating a C++ library to be used from C: Linking question
Hi there!
I'm working on a summer project which seeks to build a C++ library for the resolution of Partial Differential Equations (PDE's). The first project which shall use that library is a Reactive Transport Modelling (RTM) software which is written in C. I was reading about using classes and general C++ code from a C code from [1], but I noticed that I need to ask about the general compiler issues of writing a library, so here yields my question. In [1] you can read the following example of compiling: Quote:
Thanks in advanced for your help guys! |
Quote:
Start from man ld man ar and look up on the web tutorials, etc. The main problem though is that C++ and "C" use different naming conventions on object files. |
Ummm... yes! You need an extra application for that!
I just read it here: http://www.network-theory.co.uk/docs...tro/index.html It seems like a nice book! I was actually thinking in getting it, have you guys seen it before? |
Quote:
... The book may still be nice though. |
Thank you Sergei!
I am aware that they are actually separate applications ;) I shall take a deeper look to "ld". Regards! |
you might want to have a look at Gmic or the original greystoration in CImg.h
it uses a pde ( heat flow) to edit photos |
John VV:
Thanks! I will look at that! Actually, the library will implement Mimetic Finite Difference Methods! Which are quite amazing! |
0k guys here's the first attempt!
I created the following class in m.h: PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
Code:
$ g++ -Wall -c m_f1.cc |
Quote:
... You problem has nothing to do with the thread name which is about linking and not compilation. |
Well, I believe the problem is because of the linking within the compilation effort.
I'm trying to follow: http://developers.sun.com/solaris/ar...tml#cpp_from_c But it is a pretty vague tutorial. |
Quote:
|
Yes I had thought about that :) I still have to read better to see how can I feed the wrapper function from the C++ information but without having my main file knowing about that.
|
Quote:
Use this file both when implementing your "C" wrapper functions and in your 'main.c'. |
That is why I created my wm.h file, but because of what you say, it does not work... But know I wonder how do the wrappers within that proposed file (c_wrappers.h) would know about the class details?
|
Quote:
Code:
double add2(double a, double b) Code:
double add2(double, double); |
All times are GMT -5. The time now is 07:59 AM. |