E
Eugene Mayevski
Hello,
I am trying to declare in C++ and use in C# a delegate which contains
"ref" and "out" parameters.
I declare a delegate as:
public __delegate void SolFSCreateFileEvent(SolFSStorage* Sender,
System::String* FileName, Handle &File, bool Overwrite, bool
IsJournalFile, Error &Result);
(I also tried "[Out] Error* Result" and Error* Result, no luck).
In C# I declare a method:
public void OnCreateFile(SolFSStorage Sender, String FileName, ref UInt32
File, bool Overwrite, bool IsJournalFile, ref int Result)
and try to create an instance as
new SolFSCreateFileEvent(OnCreateFile)
What I get is compiler error:
Method 'SolFSExplorer.MainForm.OnCreateFile(SolFS.SolFSStorage, string,
ref uint, bool, bool, ref int)' does not match delegate 'void
SolFS.SolFSCreateFileEvent(SolFS.SolFSStorage, string, uint*, bool,
bool, int*)'
If I change C# declaration to
public void OnCreateFile(SolFSStorage Sender, String FileName, UInt32
*File, bool Overwrite, bool IsJournalFile, int *Result)
then the previous error disappears but another one appears, saying that
* is only allowed in unsafe context (sounds reasonable <g>).
What can be a solution besides declaring CreateFileEventArgs helper
class and passing it as a single parameter?
Free copy of SolFS (http://www.eldos.org/solfs/solfs.html) to be given
to first person who knows a solution.
Sincerely yours,
Eugene Mayevski
I am trying to declare in C++ and use in C# a delegate which contains
"ref" and "out" parameters.
I declare a delegate as:
public __delegate void SolFSCreateFileEvent(SolFSStorage* Sender,
System::String* FileName, Handle &File, bool Overwrite, bool
IsJournalFile, Error &Result);
(I also tried "[Out] Error* Result" and Error* Result, no luck).
In C# I declare a method:
public void OnCreateFile(SolFSStorage Sender, String FileName, ref UInt32
File, bool Overwrite, bool IsJournalFile, ref int Result)
and try to create an instance as
new SolFSCreateFileEvent(OnCreateFile)
What I get is compiler error:
Method 'SolFSExplorer.MainForm.OnCreateFile(SolFS.SolFSStorage, string,
ref uint, bool, bool, ref int)' does not match delegate 'void
SolFS.SolFSCreateFileEvent(SolFS.SolFSStorage, string, uint*, bool,
bool, int*)'
If I change C# declaration to
public void OnCreateFile(SolFSStorage Sender, String FileName, UInt32
*File, bool Overwrite, bool IsJournalFile, int *Result)
then the previous error disappears but another one appears, saying that
* is only allowed in unsafe context (sounds reasonable <g>).
What can be a solution besides declaring CreateFileEventArgs helper
class and passing it as a single parameter?
Free copy of SolFS (http://www.eldos.org/solfs/solfs.html) to be given
to first person who knows a solution.
Sincerely yours,
Eugene Mayevski