Jump to content

Linking a library to x1t


Melika-
 Share

Recommended Posts

Hi GWB team,

We are trying to reproduce results from Bethke et al. (2018) "Origin of microbiological zoning in groundwater flows". We can't get the FeRB.x1t script to work most of the times as x1t crashes without generating any error. I have attached the FeRB.x1t, the FeRB.dll (I used "dumpbin FeRB.dll /headers" and verified it is 64-bit), the Aquiferbasemodel.x1t, and the thermodataset (all of these files are provided by the authors, except the FeRB.dll for which I've provided the c++ script).

We have tried changing the working directory and have had no success. We currently have GWB9, but also tried it with GWB14 that was given to Goldschmidt workshop participants. Please advise.

Thanks, Melika

thermo-aquifer.dat AquiferBaseModel.x1t FeRB.cpp FeRB.x1t FeRB.dll

Link to comment
Share on other sites

Hi Melika,

What are you using to compile the dll? Could you provide either the visual studio project file or the commands used to compile the dll?

Also be aware that when you compile a dll that the dll in general will only work with the specific version of GWB that it was compiled against. It may sometimes work with other versions of GWB, but you will usually need to recompile.

 

Thanks,

Dan 

Link to comment
Share on other sites

Hi Dan,

 

I've attached a screenshot of the commands we use to generate the library (not sure if the screenshot is useful to help us figure out the problem). We're using x64 Narrative tools command prompt as you can see in the attached. The two licenses of GWB are installed on separate laptops, so each time we want to run the script, we create a new library on the laptop we're using. We always use "run as administrator" for command prompt and x1t as well.

The attached library is created with GWB14 and results in X1t crashing upon running the script.

Thanks,

Melika

 

23 hours ago, dan saalfeld said:

Hi Melika,

What are you using to compile the dll? Could you provide either the visual studio project file or the commands used to compile the dll?Also be aware that when you compile a dll that the dll in general will only work with the specific version of GWB that it was compiled against. It may sometimes work with other versions of GWB, but you will usually need to recompile.

Dan 

 

GWB Command.png

FeRB.dll FeRB.exp FeRB.lib FeRB.obj

Link to comment
Share on other sites

Hi Melika, 

Yes the screenshot was very useful, thank you for that.  I think the main issue is the fact that you are building the DLL in the GWB folder;  I ran into many odd issues when attempting to do that as well.

I would start by first cleaning up the FeRB files from the GWB folder. To do this you can just manually delete all the FeRB files ( FeRB.cpp FeRB.exp FeRB.dll FeRB.lib etc ) in the c:\program files\gwb folder.  While most of these files don't matter, it is vital you delete the FeRB.dll file.

Then instead of building directly in c:\program files\gwb I would put all the files from your first post into a folder without any weird Windows restrictions/behavior e.g. create a FeRB folder on the desktop and put all the files there.

You can then build the DLL mostly the same way, but you will need some extra flags. You can also build the DLL in a single step instead of compiling and linking separately:

cl FeRB.cpp "c:\program files\gwb\x1t.lib" /I"c:\program files\gwb\src" /link /dll /out:FeRB.dll

Assuming that succeeds then you can run X1t and properly set the working folder with:

"c:\program files\gwb\x1t" FeRB.x1t -cd

Here is a screenshot from my machine with using the same Visual Studio versions with GWB14.0.1

image.png

 

 

Hopefully this helps get you going.

-Dan

 

Link to comment
Share on other sites

Hi again Dan,

 

It did the trick; thank you very much!!! We had previously changed the working directory, as well as the directory in which we are building the library, but we had no success. I followed the steps you provided (the screenshot was very helpful) and it's working now.

 

Thanks, Melika

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...