Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > passing data to compiled C++ code

Reply
Thread Tools

passing data to compiled C++ code

 
 
runcyclexcski@yahoo.com
Guest
Posts: n/a
 
      10-26-2007
I have written an image processing app in Matlab which works fine
when
I analyse images one at a time, but is very slow when I have to
analyze thousands of images in a row. So I re-wrote the image
analysis
routine in C++, compiled in .NET. The C++ code runs about 20 times
faster than Matlab. Being a layman in programming, I am now wondering
how to make matlab talk to C++.

The C++ code is a .cpp file and an .h file. The .cpp file contains ~5
functions that talk to each other, and the main() produces the final
result. From what I understand to make a .dll I can export functions
one at a time - is that so? If yes, how can I make main () .dll talk
to the .dlls with the seconday functions and then report to matlab?
Or
do I have to bundle all functionalities into the main()?

I forgot to add that the arguments to be passed from matlab to the C+
+
code are two matrices of data type short, about 512 by 512 (two
pointers in C++ notation), and the data returned are also two
matrices of data type float or double.

 
Reply With Quote
 
 
 
 
Stuart Redmann
Guest
Posts: n/a
 
      10-26-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I have written an image processing app in Matlab which works fine
> when
> I analyse images one at a time, but is very slow when I have to
> analyze thousands of images in a row. So I re-wrote the image
> analysis
> routine in C++, compiled in .NET. The C++ code runs about 20 times
> faster than Matlab. Being a layman in programming, I am now wondering
> how to make matlab talk to C++.
>
> The C++ code is a .cpp file and an .h file. The .cpp file contains ~5
> functions that talk to each other, and the main() produces the final
> result. From what I understand to make a .dll I can export functions
> one at a time - is that so? If yes, how can I make main () .dll talk
> to the .dlls with the seconday functions and then report to matlab?
> Or
> do I have to bundle all functionalities into the main()?
>
> I forgot to add that the arguments to be passed from matlab to the C+
> +
> code are two matrices of data type short, about 512 by 512 (two
> pointers in C++ notation), and the data returned are also two
> matrices of data type float or double.


Please don't multi-post. If it can be avoided, cross-post instead (and don't
forget to set up a follow-up tag).

I posted my answer to microsoft.public.vc.language.

Regards,
Stuart
 
Reply With Quote
 
 
 
 
anon
Guest
Posts: n/a
 
      10-26-2007
(E-Mail Removed) wrote:
> I have written an image processing app in Matlab which works fine
> when
> I analyse images one at a time, but is very slow when I have to
> analyze thousands of images in a row. So I re-wrote the image
> analysis
> routine in C++, compiled in .NET. The C++ code runs about 20 times
> faster than Matlab. Being a layman in programming, I am now wondering
> how to make matlab talk to C++.
>
> The C++ code is a .cpp file and an .h file. The .cpp file contains ~5
> functions that talk to each other, and the main() produces the final
> result. From what I understand to make a .dll I can export functions
> one at a time - is that so? If yes, how can I make main () .dll talk
> to the .dlls with the seconday functions and then report to matlab?
> Or
> do I have to bundle all functionalities into the main()?
>
> I forgot to add that the arguments to be passed from matlab to the C+
> +
> code are two matrices of data type short, about 512 by 512 (two
> pointers in C++ notation), and the data returned are also two
> matrices of data type float or double.
>


I did this 6 years ago, but unfortunately I completely forgot how. I
remember that the code in c++ has to have a wrapper. We used a 3rd party
library for that.

Anyway, this has nothing to do with standard c++.

Why dont you search the net? Most likely matlab's site
 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      10-26-2007
Stuart Redmann wrote:


> Please don't multi-post. If it can be avoided, cross-post instead
> (and don't forget to set up a follow-up tag).


This is horrible advice. Do NOT cross-post with follow-up. What do you
expect, people in one or more groups to subscribe to one they don't
currently follow just to keep up with the thread? That makes no sense.

If the message was legitimate for cross-posting (and there are very
few) then the thread should continue in all groups.

The only reasonably use of cross and follow-up is when you are
redirecting a message that is not appropriate for a particular group.
Then it is reasonable to cross-post to the correct group and set
follow-ups to that one.





Brian
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separate Template Definition I wrote class Data in header. The C++Compiler compiled without errors. I decided to move all member functionsinto source code because they are for implementation. I do not like thatthey are placed in class body. Immortal Nephi C++ 12 07-30-2010 11:54 AM
If I create a page, then it's compiled upon first request, where cani find the compiled code?? lander ASP .Net 5 03-05-2008 04:34 PM
Passing data/code from code-behind to aspx aratienza ASP .Net Web Controls 1 12-10-2004 04:55 PM
Passing code/data from code-behind to ASPX page A. Atienza ASP .Net Datagrid Control 1 12-08-2004 06:29 PM
g++ compiled C++ code called from gcc compiled C code Klaus Schneider C++ 1 12-02-2004 01:44 PM



Advertisments