Hello,
I have a dll coded in delphi language which thus contains functions in delphi which I would like to use in C# under Visual Studio 2017.
I want to use for example the GENERATE function contained in test.dll.
Below is an example of C # code I made to use test.dll in delphi in C#.
- namespace AppTest
- {
- Public class Program
- {
- [DllImport("test.dll", CharSet = CharSet.Ansi)]
- public static extern bool GENERATE(string pathfilename);
-
- static void Main(string[] args)
- {
- GENERATE(@"C:\Users\file.txt");
- }
- }
- }
But when I test this program, I get the following error:
System.DllNotFoundException: 'Unable to load DLL' test.dll ': The specified module could not be found. (Exception from HRESULT: 0x8007007E) '
How to solve this problem ?
I placed test.dll in the folder that contains the C # source files.
How C# is able to read a dll in delphi if Visual Studio does not know delphi?
Thank you for your help.