B
Brendan Duffy
I assume your C++ code is traditional Win32.
Look up "DllImport" in the MSDN and try some of the samples you will find
there.
If your dll expects the client to pass user defined data structures, look up
"StructLayout" for how to reproduce the memory layout your dll expects in
C#.
If you have no experience with C or C++, it will take a little while to get
comfortable with this.
Practice with calling simple system functions like GetLastError( ) and work
your way up
Hope this gets you a little further on the path,
Enjoy.
Brendan
Look up "DllImport" in the MSDN and try some of the samples you will find
there.
If your dll expects the client to pass user defined data structures, look up
"StructLayout" for how to reproduce the memory layout your dll expects in
C#.
If you have no experience with C or C++, it will take a little while to get
comfortable with this.
Practice with calling simple system functions like GetLastError( ) and work
your way up
Hope this gets you a little further on the path,
Enjoy.
Brendan
Hello,
what I want:
Some informations/indications on writing a c# wrapper class to an unmanaged
c++ program. The c++ program is mainly a file processing application
(command line, input file, parameters, output file)
myself as developer:
I'm c# developer and I've never ever touched to c++ and dll programing with
c++, my development experience is mostly in the web development area and I'm
working with .NET only since few months with c#.
what I've quickly searched for:
c# c++ "dll wrapper" on both google.com and groups.google.com without
finding replies to this general question so I ask it here
what I have:
I've the source code project in c++
Quickly, this project is composed of
· a static main function with the following signature:
int main(int argc, char *argv[])
· a static DllMain with following signature
DllMain (
HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
I think that I will be thankfull to original c++ developer for his
sourcecode and to have make this static function since I want to use a dll
and I don't know how to implement it (like implementing anything else) with
c++.
what I will to learn:
I will first search in the main class to find process/methodcalls so I can
find stuffs that interest me so I can work to expose it in my wrapper, since
I'm almost unable to read heavy c++ code I think starting with a quick look
on the main will help me to find my way. any other recommandation that will
help me to isolate what I need
as soon what objects I want access to, how did I know if all these stuffs
are available in the
compiled dll as a ready to use/call object/method ?
what I please readership/participators that chime here:
Will anyone have allready some experience on a c# wrapper class arround a
c++ dll and can help me to find basic information and kindly
-come up with a simple exemple (as hello world is simple for newbies in a
development language)
-will summarize steps needed (what's is DllMain about and such firstcomming
questions about dll), do/don'ts common habits for writing wrapper
code/classes?
-The c++ sourcecode project is evolving, I need to track further releases to
for updating the wrapper framework, how will I organize my namespace/classes
for developing such stuffs?
Regards and much thanks for your support.
Gauthier