Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Compiling Modelica Model with Visual C++ 6.0 ?

Compiling Modelica Model with Visual C++ 6.0 ?

Hello,
is it possible to compile the C-Code produced by the openmodelica compiler with Visual Studio / Visual C++ 6.0 ?
Is there an example for making a DLL with omc and Visual Studio availible in the web ?
I would like to have a small example like the bouncing ball. I googled the whole day, but I did not find the right information.

Best Regards
Markus

Re: Compiling Modelica Model with Visual C++ 6.0 ?

Hi,

Is possible but not very easy. You will need to compile trunk/c_runtime as a .lib first.
Make a VC project, add all the .c*,.h* files in the trunk/c_runtime to the project and compile.
To break the Qt dependency use:
trunk/c_runtime/sendData/humbug.cpp, trunk/c_runtime/sendData/humbug.h
instead of
trunk/c_runtime/sendData/sendData.cpp, trunk/c_runtime/sendData/sendData.h.
Of course, you might need to fix some issues with some files as we haven't check
lately if they are compilable by VC++-

After you made a c_runtime.lib, generate the code using omc, say buildModel(Model).
Then include all the generated files in the previous made project and compile.
You should get an executable that runs the simulation. You will need Model_init.txt in the same directory as the executable in order to run it (or debug it).

If you want to inspire yourself you could take the (very old project) I put here:
http://www.ida.liu.se/~adrpo/omc/msvc-c_runtime/
You can also find some projects (old ones) in Subversion here:
https://openmodelica.ida.liu.se/svn/Ope … indows/VC7
but the c_runtime project form it is rather outdated.

We only use Visual Studio to pack the .msi release but everything is compiled with MinGW GCC.

Beware that all the projects are either VS2008 or VS2010. How come you're using the ancient 6.0?
You can download the VS express free.

Well, if you want to give it a try, post here any problems you encounter and I'll try to help you
when I get some free time.

Cheers,
Adrian Pop/

Re: Compiling Modelica Model with Visual C++ 6.0 ?

adrpo,

I took the adventure to try the first project but it appears that a VS 2003 version.  I was trying with 2008 version.  Is there any work around if you can provide me further hint?

Thanks in advance

Re: Compiling Modelica Model with Visual C++ 6.0 ?

Hi,

Oh, things have changed a lot! There is no more the old c_runtime, the new simulation runtime is here:
https://openmodelica.org/svn/OpenModeli … nRuntime/c
As far as I know we can generate VS projects for compilation of the new simulation runtime using CMake.
You will also need OMDev:
https://openmodelica.org/svn/OpenModeli … dows/OMDev
as it contains a lot of libs that are needed (sundials, etc).

I will ask Jens Frenkel to reply on this post too as he knows more about the CMake things.

Cheers,
Adrian Pop/

Re: Compiling Modelica Model with Visual C++ 6.0 ?

odrpo, thank you for your prompt comment and update.  I would be glad to try it If I find some guide on how to proceed.  By the way, I couldn't open the links you provided, it requests password which I don't have.
Again, thanks

Re: Compiling Modelica Model with Visual C++ 6.0 ?

Yeah, i forgot about that:
user: anonymous
pass: none <-- write none here

Cheers,
Adrian Pop/

Re: Compiling Modelica Model with Visual C++ 6.0 ?

Hi,

I added in the past CMake files. If you update this files (trunc/SimulationRuntime/c) it should be easy to get the project files for vs but I am not sure if it is possible to compile the generated files with vs c++ 6.0. You may have to change a few things (empty arrays for example)

Frenkel TUD

There are 0 guests and 0 other users also viewing this topic
You are here: