export dll function

  • Thread starter Thread starter An Ony
  • Start date Start date
A

An Ony

Hello,

I'm trying to write a program (dll) to use with mIRC.
mIRC wants me to use these kind of functions:

int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL
show, BOOL nopause)

translated into C# code, I think it's this:

int function(int mWnd,int aWnd, char [] data, char [] parms, bool show,bool
nopause)

now another problem is exporting this function so mIRC can see it. A
tutorial says something about creating a DEF file, but that's probably only
for C++? A search on MSDN gave me this: "This requires a DLL export, which
..NET Framework does not support" Does this mean I can't do this and all my
work was for nothing?

tia,
 
You will not be able to export dll function in C#. Maybe
mIRC will take COM objects?

Tu-Thach
 
yes mIRC can take COM objects...


Tu-Thach said:
You will not be able to export dll function in C#. Maybe
mIRC will take COM objects?

Tu-Thach
-----Original Message-----
Hello,

I'm trying to write a program (dll) to use with mIRC.
mIRC wants me to use these kind of functions:

int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL
show, BOOL nopause)

translated into C# code, I think it's this:

int function(int mWnd,int aWnd, char [] data, char [] parms, bool show,bool
nopause)

now another problem is exporting this function so mIRC can see it. A
tutorial says something about creating a DEF file, but that's probably only
for C++? A search on MSDN gave me this: "This requires a DLL export, which
..NET Framework does not support" Does this mean I can't do this and all my
work was for nothing?

tia,


.
 
C# DLLs cannot be exported due to the underlying nature of .NET. What you
might be able to do is translate your work over to C++ and do it that way,
but as for C#, it's out.


HTH,

Bill P.
Hello,

I'm trying to write a program (dll) to use with mIRC.
mIRC wants me to use these kind of functions:

int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms,
BOOL
show, BOOL nopause)

translated into C# code, I think it's this:

int function(int mWnd,int aWnd, char [] data, char [] parms, bool
show,bool
nopause)

now another problem is exporting this function so mIRC can see it. A
tutorial says something about creating a DEF file, but that's probably
only
for C++? A search on MSDN gave me this: "This requires a DLL export,
which
.NET Framework does not support" Does this mean I can't do this and all
my
work was for nothing?

tia,
 
Then you can write your COM object in C# and .NET and use
it with mIRC. You still need the .NET run-time
environment in order for it to work.

Tu-Thach
-----Original Message-----
yes mIRC can take COM objects...


Tu-Thach said:
You will not be able to export dll function in C#. Maybe
mIRC will take COM objects?

Tu-Thach
-----Original Message-----
Hello,

I'm trying to write a program (dll) to use with mIRC.
mIRC wants me to use these kind of functions:

int __stdcall procname(HWND mWnd, HWND aWnd, char
*data,
char *parms, BOOL
show, BOOL nopause)

translated into C# code, I think it's this:

int function(int mWnd,int aWnd, char [] data, char [] parms, bool show,bool
nopause)

now another problem is exporting this function so mIRC can see it. A
tutorial says something about creating a DEF file, but that's probably only
for C++? A search on MSDN gave me this: "This requires
a
DLL export, which
..NET Framework does not support" Does this mean I
can't
do this and all my
work was for nothing?

tia,


.


.
 
Hmm, I come from Java and don't know C++, but will "C++ .NET" be able to
export DLL functions?

Bill Priess said:
C# DLLs cannot be exported due to the underlying nature of .NET. What you
might be able to do is translate your work over to C++ and do it that way,
but as for C#, it's out.


HTH,

Bill P.
Hello,

I'm trying to write a program (dll) to use with mIRC.
mIRC wants me to use these kind of functions:

int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms,
BOOL
show, BOOL nopause)

translated into C# code, I think it's this:

int function(int mWnd,int aWnd, char [] data, char [] parms, bool
show,bool
nopause)

now another problem is exporting this function so mIRC can see it. A
tutorial says something about creating a DEF file, but that's probably
only
for C++? A search on MSDN gave me this: "This requires a DLL export,
which
.NET Framework does not support" Does this mean I can't do this and all
my
work was for nothing?

tia,
 
Jonathan said:
You can use Visual Studio to create Win32 dll's that are not part of
.NET. Just make a C++ project (non-managed) and make it a dll. Then
it's just like programming C++ before .NET.

It doesn't have to be a non-managed DLL. Managed C++ DLLs can export
functions. What the OP should do is make a small Managed C++ DLLs which
exports the desired functions. These functions then just delegate their
functionality to C# classes from his original project.

(Or go the COM route)
 
No of course it doesn't, but it doesn't require .NET doing it the old
fashioned way. It really depends on what the environment is.

Jonathan Schafer
 
OK, I'm trying it the COM way, first time I tried to write a COM object.
I'm having this as code:
================================================>
....
namespace QuotesDLL
{
[Guid("53D4E200-38B0-4925-9708-A96484BAF822")]
public interface QuoteInterface
{
[DispId(1)]
bool addQuote(string quote);
[DispId(2)]
string getQuote(string [] args);
[DispId(3)]
string getQuote();
}

[Guid("F4A45909-85FE-496c-AC5D-39380B92DE23")]
public class QuoteSystem : QuoteInterface
{ ...
<=================================================
that's all good, right? Those methods in the interface are made public in
the implementation. Does it hurt to make other methods private? addQuote()
uses saveQuotes() and that's declared private, that's not interfering with
the whole "COM object"-idea, is it?

now I try to compile it, in debug mode all goes well, but I get:
RegAsm warning: No types were registered
Assembly exported to '...\QuotesDLL\bin\Debug\QuotesDLL.tlb', and the type
library was registered successfully

trying to compile it in Release mode, I get a build error:
COM Interop registration failed. There are no registrable types in the built
assembly.

manual run on the debug dll:
RegAsm warning: No registry script will be produced since there are no types
to register

I've checked the registry and I can find the interfaceid, but not the class
that implements the interface.
I have no experience whatsoever with writing COM objects, so I don't know
what to do or what goes wrong.


And on final level, how do I call the COM object using mIRC? The command
works as follows:
/comopen name progid
name: some name for the connection
but what is progid in this case? QuotesDLL? QuoteSystem? QuoteInteface? The
upper hex number or the lower hex number?


thx so much!


Tu-Thach said:
Then you can write your COM object in C# and .NET and use
it with mIRC. You still need the .NET run-time
environment in order for it to work.

Tu-Thach
-----Original Message-----
yes mIRC can take COM objects...


Tu-Thach said:
You will not be able to export dll function in C#. Maybe
mIRC will take COM objects?

Tu-Thach

-----Original Message-----
Hello,

I'm trying to write a program (dll) to use with mIRC.
mIRC wants me to use these kind of functions:

int __stdcall procname(HWND mWnd, HWND aWnd, char *data,
char *parms, BOOL
show, BOOL nopause)

translated into C# code, I think it's this:

int function(int mWnd,int aWnd, char [] data, char []
parms, bool show,bool
nopause)

now another problem is exporting this function so mIRC
can see it. A
tutorial says something about creating a DEF file, but
that's probably only
for C++? A search on MSDN gave me this: "This requires a
DLL export, which
..NET Framework does not support" Does this mean I can't
do this and all my
work was for nothing?

tia,


.


.
 
Back
Top