Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Strategy for interfacing c-mex s-function with external model
Replies: 5   Last Post: Jan 9, 2012 6:11 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Rune Allnor

Posts: 4,455
Registered: 12/7/04
Re: Strategy for interfacing c-mex s-function with external model
Posted: Jan 9, 2012 4:52 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.