please help exporting function!

  • Thread starter Thread starter gs
  • Start date Start date
G

gs

I have searched Google, MSDN,... for a week. I am still unable to make
available functions in my csharp dll as native windows functions for some
legacy non dotnet application


I just want to expose the regex function to my old legacy application built
with some tools that runs a VM with capability to access windows native DLL
via declaration syntax like
public int function setRegexp(String argRegexp) alias
"ClassIeString.setRegexp"
That Vm also can access OLE automation just like vbscript or vba

In other word the VM can access any dll public functions built for windows
native non dotnet app.

I must be getting old and senile or just too dense. for anything but simple
tools. otherwise I just did not have the right search term to get succinctly
the step I need to get working. I have seen one example that did not work
and could not recompiled either

I have in my csharp code something like these

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
public class ClassIeString
{
Regex myregexp;

public int setRegexp(String argRegexp)
{
...the code....
}

public int getMatches(String myString2Match, String[] strResult,
long[] matchposn)
{
... some code...
}
}

the project properties were:
assembly name ClassIeString
deflt namespace ClassIeString
Output type Class Library
enable XP-visual styles

I also tried without and without com visible attribute

I understand what I got built was managed code so I need to wrap the
resulting dll from above built via visual studio c# 2005 beta 2..

Actually I don't care if have to use C++ to get the job done although I
would be absolutely green and ignorant there.

I would very much appreciate if someone give me some foolproof steps to make
available some regex function to the legacy application.
Please bear with me that I am not a dot net developer nor much of c, C++
coder either.
 
gs,

On it's own, you can not export functions from managed DLLs. You can
register your .NET types as COM types, so you should do that (considering
that you can use automation components).

Check out the section of the MSDN documentation titled "Exposing .NET
Framework Components to COM", located at (watch for line wrap):

http://msdn.microsoft.com/library/d.../cpconexposingnetframeworkcomponentstocom.asp

It should give you the information you need to expose your types to COM.

Hope this helps.
 
thank you, unfortunately, the ViM deals with only OLE and native DLL but not
com components.. If my understanding is correct COM is a different format
from OLE server or automation, right?

Nicholas Paldino said:
gs,

On it's own, you can not export functions from managed DLLs. You can
register your .NET types as COM types, so you should do that (considering
that you can use automation components).

Check out the section of the MSDN documentation titled "Exposing .NET
Framework Components to COM", located at (watch for line wrap):

http://msdn.microsoft.com/library/d.../cpconexposingnetframeworkcomponentstocom.asp

It should give you the information you need to expose your types to
COM.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gs said:
I have searched Google, MSDN,... for a week. I am still unable to make
available functions in my csharp dll as native windows functions for some
legacy non dotnet application


I just want to expose the regex function to my old legacy application
built with some tools that runs a VM with capability to access windows
native DLL via declaration syntax like
public int function setRegexp(String argRegexp) alias
"ClassIeString.setRegexp"
That Vm also can access OLE automation just like vbscript or vba

In other word the VM can access any dll public functions built for
windows native non dotnet app.

I must be getting old and senile or just too dense. for anything but
simple tools. otherwise I just did not have the right search term to get
succinctly the step I need to get working. I have seen one example that
did not work and could not recompiled either

I have in my csharp code something like these

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
public class ClassIeString
{
Regex myregexp;

public int setRegexp(String argRegexp)
{
...the code....
}

public int getMatches(String myString2Match, String[] strResult,
long[] matchposn)
{
... some code...
}
}

the project properties were:
assembly name ClassIeString
deflt namespace ClassIeString
Output type Class Library
enable XP-visual styles

I also tried without and without com visible attribute

I understand what I got built was managed code so I need to wrap the
resulting dll from above built via visual studio c# 2005 beta 2..

Actually I don't care if have to use C++ to get the job done although I
would be absolutely green and ignorant there.

I would very much appreciate if someone give me some foolproof steps to
make available some regex function to the legacy application.
Please bear with me that I am not a dot net developer nor much of c, C++
coder either.
 
gs,

No, OLE evolved into COM. The basics are all the same. That's why
there are still a good number of APIs that are prefixed with "Ole". COM is
the supersystem that encompases Automation. All Automation components are
COM components.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gs said:
thank you, unfortunately, the ViM deals with only OLE and native DLL but
not com components.. If my understanding is correct COM is a different
format from OLE server or automation, right?

Nicholas Paldino said:
gs,

On it's own, you can not export functions from managed DLLs. You can
register your .NET types as COM types, so you should do that (considering
that you can use automation components).

Check out the section of the MSDN documentation titled "Exposing .NET
Framework Components to COM", located at (watch for line wrap):

http://msdn.microsoft.com/library/d.../cpconexposingnetframeworkcomponentstocom.asp

It should give you the information you need to expose your types to
COM.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gs said:
I have searched Google, MSDN,... for a week. I am still unable to make
available functions in my csharp dll as native windows functions for some
legacy non dotnet application


I just want to expose the regex function to my old legacy application
built with some tools that runs a VM with capability to access windows
native DLL via declaration syntax like
public int function setRegexp(String argRegexp) alias
"ClassIeString.setRegexp"
That Vm also can access OLE automation just like vbscript or vba

In other word the VM can access any dll public functions built for
windows native non dotnet app.

I must be getting old and senile or just too dense. for anything but
simple tools. otherwise I just did not have the right search term to get
succinctly the step I need to get working. I have seen one example that
did not work and could not recompiled either

I have in my csharp code something like these

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
public class ClassIeString
{
Regex myregexp;

public int setRegexp(String argRegexp)
{
...the code....
}

public int getMatches(String myString2Match, String[] strResult,
long[] matchposn)
{
... some code...
}
}

the project properties were:
assembly name ClassIeString
deflt namespace ClassIeString
Output type Class Library
enable XP-visual styles

I also tried without and without com visible attribute

I understand what I got built was managed code so I need to wrap the
resulting dll from above built via visual studio c# 2005 beta 2..

Actually I don't care if have to use C++ to get the job done although I
would be absolutely green and ignorant there.

I would very much appreciate if someone give me some foolproof steps to
make available some regex function to the legacy application.
Please bear with me that I am not a dot net developer nor much of c,
C++ coder either.
 
Thank you for explaining.

So COM is superset of OLE automation but is it backward compatible?

What I am asking is if an application understand and can plug into OLE
automation,,\ is it truly capable of a COM component?

If so, I should be able to turn on the com visible attribute and let vstudio
2005 to expose all my public functions and classes to COM and then all I
would have to do for that application using the VM is to access via OLE
automation object. Right?



Nicholas Paldino said:
gs,

No, OLE evolved into COM. The basics are all the same. That's why
there are still a good number of APIs that are prefixed with "Ole". COM
is the supersystem that encompases Automation. All Automation components
are COM components.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gs said:
thank you, unfortunately, the ViM deals with only OLE and native DLL but
not com components.. If my understanding is correct COM is a different
format from OLE server or automation, right?

Nicholas Paldino said:
gs,

On it's own, you can not export functions from managed DLLs. You can
register your .NET types as COM types, so you should do that
(considering that you can use automation components).

Check out the section of the MSDN documentation titled "Exposing .NET
Framework Components to COM", located at (watch for line wrap):

http://msdn.microsoft.com/library/d.../cpconexposingnetframeworkcomponentstocom.asp

It should give you the information you need to expose your types to
COM.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have searched Google, MSDN,... for a week. I am still unable to make
available functions in my csharp dll as native windows functions for
some legacy non dotnet application


I just want to expose the regex function to my old legacy application
built with some tools that runs a VM with capability to access windows
native DLL via declaration syntax like
public int function setRegexp(String argRegexp) alias
"ClassIeString.setRegexp"
That Vm also can access OLE automation just like vbscript or vba

In other word the VM can access any dll public functions built for
windows native non dotnet app.

I must be getting old and senile or just too dense. for anything but
simple tools. otherwise I just did not have the right search term to
get succinctly the step I need to get working. I have seen one example
that did not work and could not recompiled either

I have in my csharp code something like these

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
public class ClassIeString
{
Regex myregexp;

public int setRegexp(String argRegexp)
{
...the code....
}

public int getMatches(String myString2Match, String[] strResult,
long[] matchposn)
{
... some code...
}
}

the project properties were:
assembly name ClassIeString
deflt namespace ClassIeString
Output type Class Library
enable XP-visual styles

I also tried without and without com visible attribute

I understand what I got built was managed code so I need to wrap the
resulting dll from above built via visual studio c# 2005 beta 2..

Actually I don't care if have to use C++ to get the job done although I
would be absolutely green and ignorant there.

I would very much appreciate if someone give me some foolproof steps to
make available some regex function to the legacy application.
Please bear with me that I am not a dot net developer nor much of c,
C++ coder either.
 
gs,

You will have to do a little more than just applying the ComVisible
attribute, but yes, in essence, all Automation objects are COM objects.
However, the reverse is not true. You need to make sure you only export
automation-compatable types in your interface (the link I gave you should
tell you how to do it).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gs said:
Thank you for explaining.

So COM is superset of OLE automation but is it backward compatible?

What I am asking is if an application understand and can plug into OLE
automation,,\ is it truly capable of a COM component?

If so, I should be able to turn on the com visible attribute and let
vstudio 2005 to expose all my public functions and classes to COM and then
all I would have to do for that application using the VM is to access via
OLE automation object. Right?



Nicholas Paldino said:
gs,

No, OLE evolved into COM. The basics are all the same. That's why
there are still a good number of APIs that are prefixed with "Ole". COM
is the supersystem that encompases Automation. All Automation components
are COM components.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gs said:
thank you, unfortunately, the ViM deals with only OLE and native DLL but
not com components.. If my understanding is correct COM is a different
format from OLE server or automation, right?

in message gs,

On it's own, you can not export functions from managed DLLs. You
can register your .NET types as COM types, so you should do that
(considering that you can use automation components).

Check out the section of the MSDN documentation titled "Exposing
.NET Framework Components to COM", located at (watch for line wrap):

http://msdn.microsoft.com/library/d.../cpconexposingnetframeworkcomponentstocom.asp

It should give you the information you need to expose your types to
COM.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have searched Google, MSDN,... for a week. I am still unable to make
available functions in my csharp dll as native windows functions for
some legacy non dotnet application


I just want to expose the regex function to my old legacy application
built with some tools that runs a VM with capability to access windows
native DLL via declaration syntax like
public int function setRegexp(String argRegexp) alias
"ClassIeString.setRegexp"
That Vm also can access OLE automation just like vbscript or vba

In other word the VM can access any dll public functions built for
windows native non dotnet app.

I must be getting old and senile or just too dense. for anything but
simple tools. otherwise I just did not have the right search term to
get succinctly the step I need to get working. I have seen one
example that did not work and could not recompiled either

I have in my csharp code something like these

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
public class ClassIeString
{
Regex myregexp;

public int setRegexp(String argRegexp)
{
...the code....
}

public int getMatches(String myString2Match, String[] strResult,
long[] matchposn)
{
... some code...
}
}

the project properties were:
assembly name ClassIeString
deflt namespace ClassIeString
Output type Class Library
enable XP-visual styles

I also tried without and without com visible attribute

I understand what I got built was managed code so I need to wrap the
resulting dll from above built via visual studio c# 2005 beta 2..

Actually I don't care if have to use C++ to get the job done although
I would be absolutely green and ignorant there.

I would very much appreciate if someone give me some foolproof steps
to make available some regex function to the legacy application.
Please bear with me that I am not a dot net developer nor much of c,
C++ coder either.
 
Back
Top