TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Deepika Singh
NA
21
6.6k
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 :
namespace
FRAMModel.Engine
{
[Guid(
"D8329E9D-DAC7-4399-85DC-A3A0AD3147FF"
)]
[ComVisible(
true
)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public
interface
IScoreGenerator
{
IFRMModelResponse Generate(IFRMModelRequest request);
}
}
Class file for testing purpose:
namespace
FRAMModel.Engine
{
[Guid(
"3C87AE3B-B093-413B-B569-4800085B8E02"
)]
[ComVisible(
true
)]
[ClassInterface(ClassInterfaceType.None)]
public
class
ScoreGenerator : IScoreGenerator
{
public
ScoreGenerator()
{}
public
IFRMModelResponse Generate(IFRMModelRequest request)
{
var response =
new
FRMModelResponse();
// Handling null input parameter
if
(request ==
null
)
{
response.ErrorNumber = 1001;
response.ErrorDescription =
"Null request parameter value"
;
response.FRMScore =
null
;
return
response;
}
response.FRMScore =
new
decimal
[] { 2, 5, 3, 6 };
return
response;
}
}
}
Input file interface :
namespace
FRAMModel.Engine.ExternalContract
{
[Guid(
"41257D86-84AB-47A4-B09F-110E110988F8"
)]
[ComVisible(
true
)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public
interface
IFRMModelRequest
{
int
[] IdxInBlock {
get
;
set
; }
int
[] OperationalSectorCount {
get
;
set
; }
int
[] IsaHomeStandbyFlag {
get
;
set
; }
string
[] StartDateLocalTime {
get
;
set
; }
string
[] StartTimeLocalTime {
get
;
set
; }
string
[] EndDateLocalTime {
get
;
set
; }
string
[] EndTimeLocalTime {
get
;
set
; }
string
[] EndDateCrewReferenceTime {
get
;
set
; }
string
[] EndTimeCrewReferenceTime {
get
;
set
; }
string
[] StartDateTimeZulu {
get
;
set
; }
string
[] EndDateTimeZulu {
get
;
set
; }
string
[] DutyLength {
get
;
set
; }
int
[] IsDutyMorningStart {
get
;
set
; }
int
[] IsDutyEveningFinish {
get
;
set
; }
int
[] IsDutyNightFinish {
get
;
set
; }
int
[] IsDutyElongated {
get
;
set
; }
int
[] IsDutyHighSector {
get
;
set
; }
string
[] HoursBetweenMidnight {
get
;
set
; }
}
}
Input file class :
namespace
FRAMModel.Engine.ExternalContract
{
[Guid(
"8B1B03EB-E0F4-4CCB-B334-1854D2BF20C5"
)]
[ComVisible(
true
)]
[ClassInterface(ClassInterfaceType.None)]
public
class
FRMModelRequest : IFRMModelRequest
{
public
FRMModelRequest()
{ }
int
[] IdxInBlock {
get
;
set
; }
int
[] OperationalSectorCount {
get
;
set
; }
int
[] IsaHomeStandbyFlag {
get
;
set
; }
string
[] StartDateLocalTime {
get
;
set
; }
string
[] StartTimeLocalTime {
get
;
set
; }
string
[] EndDateLocalTime {
get
;
set
; }
string
[] EndTimeLocalTime {
get
;
set
; }
string
[] EndDateCrewReferenceTime {
get
;
set
; }
string
[] EndTimeCrewReferenceTime {
get
;
set
; }
string
[] StartDateTimeZulu {
get
;
set
; }
string
[] EndDateTimeZulu {
get
;
set
; }
string
[] DutyLength {
get
;
set
; }
int
[] IsDutyMorningStart {
get
;
set
; }
int
[] IsDutyEveningFinish {
get
;
set
; }
int
[] IsDutyNightFinish {
get
;
set
; }
int
[] IsDutyElongated {
get
;
set
; }
int
[] IsDutyHighSector {
get
;
set
; }
string
[] HoursBetweenMidnight {
get
;
set
; }
}
}
Response file interface :
namespace
FRAMModel.Engine.ExternalContract
{
[Guid(
"293045D7-9BFC-46C3-95A7-5046994CD131"
)]
[ComVisible(
true
)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public
interface
IFRMModelResponse
{
decimal
[] FRMScore {
get
;
set
; }
int
ErrorNumber {
get
;
set
; }
string
ErrorDescription {
get
;
set
; }
}
}
response file class :
namespace
EasyJet.FRAMModel.Engine.ExternalContract
{
[Guid(
"170C6A12-4B21-4DB1-AB3F-DE0CCB9B243A"
)]
[ComVisible(
true
)]
[ClassInterface(ClassInterfaceType.None)]
public
class
FRMModelResponse : IFRMModelResponse
{
public
FRMModelResponse()
{}
decimal
[] FRMScore {
get
;
set
; }
int
ErrorNumber {
get
;
set
; }
string
ErrorDescription {
get
;
set
; }
}
}
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
Reply
Answers (
1
)
How to open outlook using c#
How can i register com+ application using msi?