×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to create a dll file from some C files and Object files with mex

How to create a dll file from some C files and Object files with mex

How to create a dll file from some C files and Object files with mex

(OP)
Hi all,
I'm a newbie here. I am trying to compile some provided .c, .h and .m files. The C files already has the mexfunction. They can be compiled in Unix without a problem but I want to try to compile it in PC. I have looked into Matlab help and MSDN documentation on how to compile the C files and Object files.
For creating a dll file from a C file (without a header .h file) is not a problem, and I manage to do that by typing this command in the Matlab prompt
>> mex examplefile1.c
A file called examplefile1.dll is created.

However I have a problem in linking some C files with Object files as below
>> mex exfile1.c objfile2.obj objfile3.obj
(Note that there is some header files involved)

The error report that I get
exfile1.obj : error LNK2001: unresolved external symbol _vector_addition
exfile1.obj : error LNK2001: unresolved external symbol _equalizer_diversity
exfile1.dll : fatal error LNK1120: 2 unresolved externals
 
  C:\MATLAB6P1\BIN\WIN32\MEX.PL: Error: Link of 'exfile1.dll' failed.

Do you guys have any idea?

RE: How to create a dll file from some C files and Object files with mex

Hi,
Try to make a library file containing all your functions and then link it with the main program using the mcc of Matlab.
I believe there is an example in the Matlab compiler help.
Joe
BSTeX- Equation viewer for Matlab
http://www.geocities.com/bstex2001

Joe
BSTeX- Equation viewer for Matlab
http://www.geocities.com/bstex2001

RE: How to create a dll file from some C files and Object files with mex

(OP)
I'm not sure, but I have tried it on VC++ by using the Matlab Add-Inn to create the dll files. It is still the same error report came out. I am really not sure what to do next :(

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources