M
Matyi
Hello everybody!
I've this problem:
I'm working on a download meter, based on wpcap. As wpcap code is
unmanaged, I decided to create the needed functions in a unmanaged
project (one for opening an an adapter and capturing the packets (and
thus counting the data downloaded), one for getting the byte-count and
one for stopping the packet capturing), and place them in a dll, which
exports functions
void capture(),
void stopping(),
long getbytes().
And now I want to import these functions into a managed C++
application.
So I created a class pcapImport, and inside it I've tried to somehow
import those functions.
I've tried this:
[DllImport("pcapDLL.dll")] extern "C" long getbytes (); but I couldn't
even compile that thing, i got an error: C2059, syntax error,
then I tried this
[DllImport("pcapDLL.dll")] extern long getbytes ();
and got an error: C2720, 'extern' storage-class specifier illegal on
members
and finally tried this:
[DllImport("pcapDLL.dll")] static long getbytes ();
In this case no compilation error occurred, but the pcapDLL.dll hadn't
been loaded (not listed among the modules) and although it doesn't
throws an exception (something like function does not exist) it just
doesn't do anything.
Well, I've Googled a lot, but hadn't find anything what's working.
I'd appreciate any help.
Thanks,
Matyi
I've this problem:
I'm working on a download meter, based on wpcap. As wpcap code is
unmanaged, I decided to create the needed functions in a unmanaged
project (one for opening an an adapter and capturing the packets (and
thus counting the data downloaded), one for getting the byte-count and
one for stopping the packet capturing), and place them in a dll, which
exports functions
void capture(),
void stopping(),
long getbytes().
And now I want to import these functions into a managed C++
application.
So I created a class pcapImport, and inside it I've tried to somehow
import those functions.
I've tried this:
[DllImport("pcapDLL.dll")] extern "C" long getbytes (); but I couldn't
even compile that thing, i got an error: C2059, syntax error,
then I tried this
[DllImport("pcapDLL.dll")] extern long getbytes ();
and got an error: C2720, 'extern' storage-class specifier illegal on
members
and finally tried this:
[DllImport("pcapDLL.dll")] static long getbytes ();
In this case no compilation error occurred, but the pcapDLL.dll hadn't
been loaded (not listed among the modules) and although it doesn't
throws an exception (something like function does not exist) it just
doesn't do anything.
Well, I've Googled a lot, but hadn't find anything what's working.
I'd appreciate any help.
Thanks,
Matyi