f



Using Matlab functions in Visual C

Hi there,

Could someone please help me, I am attempting to call functions in my
shared library - which was created using the Matlab compiler - from
my MSVC program.

I get the following error when I call any of the library functions;

error C2065: 'mlfFunc' : undeclared identifier

I have included the header file in my program and changed the project
settings to link the library to the program.

Any help would be great, I have been having trouble with this for a
while now,
Thank you, Lisa
0
10/24/2006 10:09:55 AM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
659 Views

Similar Articles

[PageSpeed] 28

Can anyone help me??
plz
0
10/24/2006 2:56:00 PM
Hi Lisa,

I'm pretty sure I can help you, but you haven't given me a lot to
work from.

You used the MATLAB Compiler to compile an m-file into a DLL? And
then you're trying to call the function from C (or C++)?

C2065 is a compiler error. It usually means that you haven't
included the proper header (.h) file in your calling source file.
You can either include the proper header, or just declare the
external function in your source (for example):

   extern void mlfFunc(int x, double y);

bottom line, the compiler doesn't know what the symbol mlfFunc is.
You need to tell it. Later on, when you get to the linker, you may
have other issues.

If mlfFunc is exported (i.e. publicly available in the DLL) as a C
function, and you are writing a C++ program, you need to make sure
that you declare the function as:

   extern "C" { extern void mlfFunc(...); }

Otherwise the C++ compiler "mangles" (or decorates) the name and
looks for something like "mlfFunc@@2wzq", which doesn't exist.

I can go on for hours. Let me know if any of that helps.

Luck,

reilly.

 Lisa McCann wrote:
>
>
> Hi there,
>
> Could someone please help me, I am attempting to call functions in
> my
> shared library - which was created using the Matlab compiler - from
> my MSVC program.
>
> I get the following error when I call any of the library functions;
>
> error C2065: 'mlfFunc' : undeclared identifier
>
> I have included the header file in my program and changed the
> project
> settings to link the library to the program.
>
> Any help would be great, I have been having trouble with this for a
> while now,
> Thank you, Lisa
0
John
10/27/2006 3:46:11 PM
Reply: