Is it possible to create a DLL using C# that can be declared and run in FOXPRO:
I am using the following C# code to create TESTCODE.DLL :
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
class DirectoryLister
{
public static void Main(string[] args)
{
int i = 0;
String FILE_NAME = "C:/Test.txt";
String path;
String name;
name = " ";
int j = args.Length;
Console.WriteLine("HIT SPOT A " + j.ToString());
if (args.Length > 1)
{
Console.WriteLine("HIT SPOT B");
Console.WriteLine(args[0]);
Console.WriteLine(args[1]);
if (Directory.Exists(args[0]))
{
path = args[0];
}
else
{
return;
}
FILE_NAME = args[1];
FILE_NAME.Trim();
if (File.Exists(FILE_NAME))
{
File.Delete(FILE_NAME);
}
StreamWriter sr = File.CreateText(FILE_NAME);
DirectoryInfo dir = new DirectoryInfo(path);
foreach (FileInfo f in dir.GetFiles()) i = i + 1;
if (i == 0)
{
sr.WriteLine( "NO FILES FOUND THAT MEET SPECS");
}
else
{
sr.WriteLine(i.ToString());
sr.WriteLine(path);
sr.WriteLine(FILE_NAME);
foreach (FileInfo f in dir.GetFiles())
{
name = f.Name;
long size = f.Length;
DateTime creationTime = f.CreationTime;
sr.WriteLine(name);
}
}
sr.Close();
}
}
}
When I attempt to run the DLL in FOXPRO:
DECLARE INTEGER main IN TESTCODE.DLL I = main()
After attempting to run the FOXPRO program, I get the following message:
Cannot find entry point in main in the DLL.
Visual Studio Express Editions17
|