Abaqus user subroutines and dlls

I had met the problem of calling DLL in ABAQUS subroutine several years ago. I posted my question asking for help. Unfortunately, that was not solved.

Today I got a reply and suggest the following method. I have not tried yet but just copy down here as a back up.




My post:



In a similar line to Calling Fortran Dlls from Fortran executables I could successfully use a subroutine defined in a fortran dll in an abaqus subroutine. This was two months ago, but I have a little time now and can write about this.

The first thing you need to do is in Visual Studio 2008 or 2010 create a project of type Intel Visual Fortran -> Library -> Dynamic-link library

Put the subroutine there, we can use the same example as before:

Code: Select all
!dec$ attributes dllexport::Add
subroutine Add(a,b,c)
implicit none

real(8), intent(in)  :: a,b

real(8), intent(out) :: c

c = a+ b


Compile in release mode. You will find two files a .lib and a .dll

Copy the .lib file to really simple directory, for example C:\lib and copy the dll to C:\SIMULIA\Abaqus\6.10-2\exec

Now in whatever subroutine you want to use (umat, ugens, etc) where you want to use the very useful add subroutine simply add this line

Code: Select all
!dec$ attributes dllimport::Add

and modify the link_sl variable inside the environment file (C:\SIMULIA\Abaqus\6.10-2\site\abaqus_v6.env)

Code: Select all
link_sl='cmd /c "LINK /nologo /INCREMENTAL:NO /subsystem:console /machine:AMD64 blah blah lots of libs C:\\lib\\Add.lib && mt /manifest %U.manifest /outputresource:%U;2 && del %U.manifest"'

See the C:\\lib\\Add.lib? that tells the linker where to find the definition of add, the actual binary is searched at runtime (hence the dynamic thing) and that is why we copied the Add.dll to the exec folder.

I hope you manage to do this aswell


About yhtian

I am an academic researcher working on Offshore Geotechnical Engineering. My blog aims to write down some work related trivial things and tricks about software, programming. It is basically a memo for me to back up some thoughts and small details. But I am more than happy if someone would visit and discuss.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s