Deepika Singh

Deepika Singh

  • 2.1k
  • 21
  • 4.3k

c#.net dll to be consumed in delphi application

Oct 31 2017 6:15 AM
I have created a c#.net dll "FRAMModel.dll"on VS 2013, whose target framework is x64. It has to be consumed in client application which is a delphi application. I have done all settings to make it COM visible. But client says they are using it in a test application using LOADLibrary command and This command does not find the dll, and thus does not result a handle to it. They do not want to register it on their system. Infact they are not even able to dump file.   
 
 
 
We are exposing one interface with class having single method only, which takes some input as an array of strings and provide output in same format.  
 
Interface is :  
  1. namespace FRAMModel.Engine  
  2. {  
  3. [Guid("D8329E9D-DAC7-4399-85DC-A3A0AD3147FF")]  
  4. [ComVisible(true)]  
  5. [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]  
  6. public interface IScoreGenerator  
  7. {  
  8. IFRMModelResponse Generate(IFRMModelRequest request);  
  9. }  
  10. }  
Class file for testing purpose:  
  1. namespace FRAMModel.Engine  
  2. {  
  3. [Guid("3C87AE3B-B093-413B-B569-4800085B8E02")]  
  4. [ComVisible(true)]  
  5. [ClassInterface(ClassInterfaceType.None)]  
  6. public class ScoreGenerator : IScoreGenerator  
  7. {  
  8. public ScoreGenerator()  
  9. {}  
  10. public IFRMModelResponse Generate(IFRMModelRequest request)  
  11. {  
  12. var response = new FRMModelResponse();  
  13. // Handling null input parameter  
  14. if (request == null)  
  15. {  
  16. response.ErrorNumber = 1001;  
  17. response.ErrorDescription = "Null request parameter value";  
  18. response.FRMScore = null;  
  19. return response;  
  20. }  
  21. response.FRMScore = new decimal[] { 2, 5, 3, 6 };  
  22. return response;  
  23. }  
  24. }  
  25. }  
Input file interface :
  1. namespace FRAMModel.Engine.ExternalContract  
  2. {  
  3. [Guid("41257D86-84AB-47A4-B09F-110E110988F8")]  
  4. [ComVisible(true)]  
  5. [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]  
  6. public interface IFRMModelRequest  
  7. {  
  8. int[] IdxInBlock { getset; }  
  9. int[] OperationalSectorCount { getset; }  
  10. int[] IsaHomeStandbyFlag { getset; }  
  11. string[] StartDateLocalTime { getset; }  
  12. string[] StartTimeLocalTime { getset; }  
  13. string[] EndDateLocalTime { getset; }  
  14. string[] EndTimeLocalTime { getset; }  
  15. string[] EndDateCrewReferenceTime { getset; }  
  16. string[] EndTimeCrewReferenceTime { getset; }  
  17. string[] StartDateTimeZulu { getset; }  
  18. string[] EndDateTimeZulu { getset; }  
  19. string[] DutyLength { getset; }  
  20. int[] IsDutyMorningStart { getset; }  
  21. int[] IsDutyEveningFinish { getset; }  
  22. int[] IsDutyNightFinish { getset; }  
  23. int[] IsDutyElongated { getset; }  
  24. int[] IsDutyHighSector { getset; }  
  25. string[] HoursBetweenMidnight { getset; }  
  26. }  
  27. }  
Input file class :
  1. namespace FRAMModel.Engine.ExternalContract  
  2. {  
  3. [Guid("8B1B03EB-E0F4-4CCB-B334-1854D2BF20C5")]  
  4. [ComVisible(true)]  
  5. [ClassInterface(ClassInterfaceType.None)]  
  6. public class FRMModelRequest : IFRMModelRequest  
  7. {  
  8. public FRMModelRequest()  
  9. { }  
  10. int[] IdxInBlock { getset; }  
  11. int[] OperationalSectorCount { getset; }  
  12. int[] IsaHomeStandbyFlag { getset; }  
  13. string[] StartDateLocalTime { getset; }  
  14. string[] StartTimeLocalTime { getset; }  
  15. string[] EndDateLocalTime { getset; }  
  16. string[] EndTimeLocalTime { getset; }  
  17. string[] EndDateCrewReferenceTime { getset; }  
  18. string[] EndTimeCrewReferenceTime { getset; }  
  19. string[] StartDateTimeZulu { getset; }  
  20. string[] EndDateTimeZulu { getset; }  
  21. string[] DutyLength { getset; }  
  22. int[] IsDutyMorningStart { getset; }  
  23. int[] IsDutyEveningFinish { getset; }  
  24. int[] IsDutyNightFinish { getset; }  
  25. int[] IsDutyElongated { getset; }  
  26. int[] IsDutyHighSector { getset; }  
  27. string[] HoursBetweenMidnight { getset; }  
  28. }  
  29. }  
Response file interface :
  1. namespace FRAMModel.Engine.ExternalContract  
  2. {  
  3. [Guid("293045D7-9BFC-46C3-95A7-5046994CD131")]  
  4. [ComVisible(true)]  
  5. [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]  
  6. public interface IFRMModelResponse  
  7. {  
  8. decimal[] FRMScore { getset; }  
  9. int ErrorNumber { getset; }  
  10. string ErrorDescription { getset; }  
  11. }  
  12. } 
response file class :
  1. namespace EasyJet.FRAMModel.Engine.ExternalContract  
  2. {  
  3. [Guid("170C6A12-4B21-4DB1-AB3F-DE0CCB9B243A")]  
  4. [ComVisible(true)]  
  5. [ClassInterface(ClassInterfaceType.None)]  
  6. public class FRMModelResponse : IFRMModelResponse  
  7. {  
  8. public FRMModelResponse()  
  9. {}  
  10.    
  11. decimal[] FRMScore { getset; }  
  12. int ErrorNumber { getset; }  
  13. string ErrorDescription { getset; }  
  14. }  
  15. }  
we don't have deplhi environment to test. We are assuming from error that they are testing it on some C++ application. But nothing helps.
 
We have done setting on build :
Make assembly COM-Visible : True 
Register for COM-Interop : True
We have craeted strong name for assembly and sign it.
 
Please help

Answers (1)