Compiling user-defined functions

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

i was able to compile user-defined functions for density and viscosity.  I compile them individually and when i run my analysis, it gives me the following error: 

 

*** ERROR: Unable to locate function <methaneViscosity> in libraries <./libusr.dll,~/libusr.dll>

 

where methaneViscosity is the first user defined function that i compile.  

 

to clarify, i submit the following two commands: acuMakeDll -src methaneViscosity.c  and  acuMakeDll -src methaneDensity.c . Since i submit the commands individually, each creates a  libusr.lib and object libusr.exp .  This means that the libusr.lib/libusr.exp created by the first acuMakeDll commands is overwritten by the second acuMakeDll.  I believe this is the reason why the error occurs.  

 

 

Tagged:

Answers

  • acupro
    acupro
    Altair Employee
    edited May 2018

    Correct - you need to make sure the compiled DLL includes both functions.  If you don't add the -src flag (so just   acuMakeDLL   ) it will compile any .c file sitting in that directory.  You could also include the -src flag, then use a comma-separated list to indicate which .c files to include.  (On Windows, the comma-separated list may not be understood, in which case you'll need to put the list in the local Acusim.cnf file.  See    acuMakeDll -h    for usage.)

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2018

    acupro, 

     

    thank you very much for the help.  Unfortunately, a comma-separated list did not work on windows, and I could not find any documentation on how to provide the list on the local Acusim.cnf file ( C:\Program Files\Altair\2017-edu\acusolve\win64\script\Acusim.cnf ).  Keep in mind that i have very basic computer skills, and acuMakeDll -h did not provide much assistance.  I was able to compile using only acuMakeDll (which you mentioned will compile any .c file in the directory), which meant i had to move other user-defined functions that i'm still working on to a different directory, while i compile the user defined functions i listed previously. 

     

    if you have time, i would appreciate any help you can provide on how to provide a list to the .cnf file. 

     

    Thank you

     

  • acupro
    acupro
    Altair Employee
    edited May 2018

    You can have an Acusim.cnf file in your local problem directory as well.  The Acusim.cnf file in your installation would generally have option that apply to all projects.  The local (in problem directory) would apply only to that particular problem.  If you don't have one, create Acusim.cnf file in the local problem directory, then add to it:

     

    problem  =  problem_name                            #Put the problem name there, - in place of problem_name, makes it easier so you don't have to type problem name so often

    user_source_files  =  methaneViscosity.c,methaneDensity.c

     

    To test that, issue     acuMakeDll  -h     and you should see that list of source files after the -src option