|
|
Re: Strategy for interfacing c-mex s-function with external model
Posted:
Jan 9, 2012 4:52 PM
|
|
On 9 Jan, 21:34, "Kate J." <kmj.w...@gmail.com> wrote:
> ~ One additional consideration: the .dll that contains the biomechanical model function I?d like to use is written in C++, whereas my c-mex s-function is, of course, in C. However, it doesn?t appear that there are many real syntax differences, apart from minor issues such as comment indicators, etc. In another part of my system, the ?extern C? keyword is used to make C++ code compatible with my C code, so I?m thinking that this *may* be an option here, as well.
You should think very carefully through how you will publish the C++ interface. Yes you are right in that the 'extern C' keyword transforms the C++ code to be callable from C, but that only works for free functions, not objects.
Depending on how far you will distribute your code, there is an option to write you C and C++ code independently, and compile it as C++ MEX. This option might save you a lot of grief.
Rune
|
|