First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
1

Call a external .dll from the fortran user model

asked Apr 29 '19

smint85 gravatar image

Hello,

I would like to create a user written model in which I could call a external .dll containing the whole PLC code of the real machine. Is this possible? Is it possible to gather everything (original .dll + user fortran code) in only one .dll to share with other people?

regards, V

1 answer

Sort by » oldest newest most voted
1

answered Apr 30 '19

txc gravatar image

I am assuming you have the external dll and also the fortran code that was used to compile this dll (say we name this dll A). What you can do in your fortran code is call the subroutines that are in the dll A. Say the dll A has a subroutine called plcmodel(mc,slot), you can in your fortran code, call this subroutine plcmodel with proper arguments defined. You can then use the environment manager to compile both the fortran codes into one dll say dsusr.dll and then share with whoever you want to.

If you only have the dll A and not the fortran code that was used to compile the dll A, then you can't do what you intend to. However if you have the object file, you can do the above.

If you want to know which subroutines are called in the dll A, you can use a free software called dependency Walker that tells you what subroutines are exported in the dll.

link

Comments

Thank you. I do not have access to the fortran code of dll A. but I will try to get the .obj to include everything in only 1 dll.

smint85 gravatar imagesmint85 (May 6 '19)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Apr 29 '19

Seen: 1,182 times

Last updated: Apr 29 '19