Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Trying to include an external dll (compiled from c)
Posted 14.01.2024, 11:15 GMT-5 API, Modeling Workflow, User Interface Version 6.2 3 Replies
Please login with a confirmed email address before reporting spam
Hello,
I am trying to use a custom function in comsol. For testing purposes, I have written a short c file:
double f(double x, double y, double z);
double f(double x, double y, double z) {
double r;
r = x * (1 + 1*(y-z) + 1*(y-z));
return r;
}
Then I compiled my code as adviced on suggested on cygwin with the commands gcc -c test.c
and then gcc -shared -o test.dll test.o
.
Now in Global Definitions, I created a new instance with right click -> functions -> extern, filled out function name with "f" and arguments with "x, y, z" and finally created 3 entries in plot parameters ranging from 0 to 10 for every entry.
Now if I click "plot" or "create plot" I get an error saying "Symbol not found". I have googled and asked Bing "to google for me" but I dont find any resource that helps me here.
How do I make this work?