tags:

views:

326

answers:

1

For a project I'm working on I'd like to use WordNet to do some linguistic classification of user input, and I'd like to use the Prolog version of the database.

I've tried P#, which works reasonably well, but which appears to be unable to handle the sheer size of the WordNet databases. It can compile the smallest of the files I want to use (218 kB), but when I try to compile the two larger ones (2.3 and 7.3 MB, respectively) it fails after about half an hour of work and Windows pops up the "Something went wrong. Send report to Microsoft?" dialog.

I've also tried Prolog.Net, which just appears to not work very well.

Finally, I tried the C# bindings for SWI-Prolog, but can't get them to work properly. When I try to run the example code, it fails at the PLEngine.Initialise() step, claiming that something it tries to load (a DLL I assume) is an invalid Win32 application (a BadImageFormatException).

Does anyone have either any suggestions for other ways to integrate C# and Prolog, or some suggestions to get the solutions I've already tried to work? OS is Windows server 2008 (64 bit), SWI Prolog is version 5.7.11.

+1  A: 

Perhaps you are having problems with 32 bit SWI-Prolog on 64 bit Windows. If your platform target is Any CPU it might be the cause of your problems. You can fix this by opening the properties pages for you C# project. Select the Build tab and change the Platform target to x86.

If you currently are using Any CPU your application will run in 64 bit on 64 bit Windows. Trying to load an 32 bit DLL will fail miserably.

Martin Liversage
Thanks! Changing to x86 fixed it (should've thought to try that myself). Now, the part that uses Prolog is just one part of a larger project. Will changing this project's target to x86 mean that everything has to target x86, or does .Net magically save me from this somehow?
arnsholt
If you target x86 your entire application will run in 32 bit. You have to do this since SWI-Prolog is 32 bit. I wouldn't be to concerned though. You are probably using Visual Studio as your development tool and that too is running in 32 bit. If you application involves multiple processes communicating by some means it is of course possible to have some processes running in 32 bit and some in 64 bit.
Martin Liversage