Click here to Skip to main content
16,020,811 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have a class called "Print" and in that i have a method called "printfile". and i have to call that method in prolog .net file.

here is the sample code:
C#
public class Print
{
       public Print()
       {
           //code
       }
       public static void printfile(string at)
       {
           StreamWriter w = new StreamWriter("c:\filetest.txt", true);
           w.WriteLine(at);
           w.Close();
       }
}


then i convert this class in .dll and uses in prolog .net class.

prolog .net class:
assembly('print.dll').

:-class('Test').


testfile:-'Print'::'printfile'('test').

but when i execute this it gives error "Object reference is not set to an instance of an object"

please tell me what should i do...
Posted
Updated 21-Mar-10 23:59pm
v3

Plz if you get the Ansewer
plz email me at samibelkhiri@live.com
 
Share this answer
 
ok try with this


testfile(X):-object('print',Objt), invoke(Objt,'printfile'(X)).
 
Share this answer
 
Why do you define a printfile method and then you try to call a Writefile one?
:)
 
Share this answer
 
My guess is that you either have to instantiate your Print object, or you have to make the PrintFile method static.

I didn't know there even *was* a Prolog.Net...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900