How to work with loadlibrary and C header files

Hey,
I know that this question is only down to me not knowing the basics of working with c so I hoop that somebody is able to help me with this.
For a project I have to create a struct in c and then use this stuct to load it into matlab using loadlibrary and this example: https://nl.mathworks.com/matlabcentral/answers/41648-converting-matlab-struct-to-c-struct-and-access-byte-data
However I have no idea how to even create the right files in the c language and I cant find any information on this online.
I have attached the c file as a txt file to this question.
Any help or tips are welcome as I am completely stuck and have no idea how to fix this problem.
Thanks!

5 Comments

loadlibrary( ) is used to call functions. I don't see any functions in your posted C code.
However I have not been succesfull in this yet
Do you know how i could make this work?
I get the error that the header file is not a valid Win32 application.
When I look for solutions it tells me that I need to install the 32bit version of matlab, however there must be a way to change my own created file into a compatible format right?
You need to compile your code as a 64 bit dll, otherwise you can't use it with MATLAB.
yeah i tried doing that with gcc -m64 however I still get the same error

Sign in to comment.

Answers (0)

Categories

Products

Asked:

on 8 Aug 2020

Commented:

on 10 Aug 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!