www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - writing c code in a c++ app

↑ ↓ ← david <david_member pathlink.com> writes:
Hello,

I am having difficulties in writing a c++ prog that uses C code to send an icmp
packet (icmpapi.h, ipexport.h (used by icmpapi.h)).  This is what my code looks
like so far:



-------------------------------------
#include <iostream>
#include <windows.h>

extern "C" {
#include <icmpapi.h>
}

int main(){
using namespace std;
HANDLE icmp;
icmp = IcmpCreateFile();

cout << "hello";
return 0;
}
________________________________________________


It compiles but then i get an error that says:

_______________________________________________
hello.obj(hello)
Error 42: Symbol Undefined _IcmpCreateFile 0

--- errorlevel 1
_______________________________________________




Before i added the:
extern "C" 

I would get the error:

_____________________________________________________________________
hello.obj(hello)
Error 42: Symbol Undefined ?IcmpCreateFile  YGPAXXZ (void *stdcall
IcmpCreateFile (void ))

--- errorlevel 1
_____________________________________________________________________


Any insight would be greatly appreciated.  Is there a way to send a custom icmp
packet using C++ libraries?  This might help some.  The code for sending the
exact packet I need to send is already written in C for me, so ideally I would
like to write a C++ prog that does some extra work but also sends the icmp
packet (exactly as written in the already existing C code that I have).


Thank you,

David S
Feb 10 2005
↑ ↓ Jack <Jack_member pathlink.com> writes:
You have to link it together with the import library of icmp.dll. You can make
the import library yourself.
Start command prompt and type this:
implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or
C:\WINDOWS\system32\icmp.dll for winxp)

Just link it together when you compile your source:
dmc hello.cpp icmp.lib

or if you just compile the source only (with the -c option) and you would like
to link it yourself:
link hello.obj icmp.lib

In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...
Hello,

I am having difficulties in writing a c++ prog that uses C code to send an icmp
packet (icmpapi.h, ipexport.h (used by icmpapi.h)).  This is what my code looks
like so far:



-------------------------------------
#include <iostream>
#include <windows.h>

extern "C" {
#include <icmpapi.h>
}

int main(){
using namespace std;
HANDLE icmp;
icmp = IcmpCreateFile();

cout << "hello";
return 0;
}
________________________________________________


It compiles but then i get an error that says:

_______________________________________________
hello.obj(hello)
Error 42: Symbol Undefined _IcmpCreateFile 0

--- errorlevel 1
_______________________________________________




Before i added the:
extern "C" 

I would get the error:

_____________________________________________________________________
hello.obj(hello)
Error 42: Symbol Undefined ?IcmpCreateFile  YGPAXXZ (void *stdcall
IcmpCreateFile (void ))

--- errorlevel 1
_____________________________________________________________________


Any insight would be greatly appreciated.  Is there a way to send a custom icmp
packet using C++ libraries?  This might help some.  The code for sending the
exact packet I need to send is already written in C for me, so ideally I would
like to write a C++ prog that does some extra work but also sends the icmp
packet (exactly as written in the already existing C code that I have).


Thank you,

David S

Feb 11 2005
↑ ↓ david <david_member pathlink.com> writes:
When i attempt:
dmc hello.cpp icmp.lib
it says:
Error 43:  Not a Valid Library File

The file is in the 'lib' directory and it does indicate that its attempting to
link the .lib file.  Do I just have a bad .lib file?  What about the icmp.dll
file?  Does the .lib file use the .dll file in the system32 folder?  I have one
in my system32 right now, so I am assuming I am ok there.

Thank you,

David

In article <cuif84$235e$1 digitaldaemon.com>, Jack says...
You have to link it together with the import library of icmp.dll. You can make
the import library yourself.
Start command prompt and type this:
implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or
C:\WINDOWS\system32\icmp.dll for winxp)

Just link it together when you compile your source:
dmc hello.cpp icmp.lib

or if you just compile the source only (with the -c option) and you would like
to link it yourself:
link hello.obj icmp.lib

In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...
Hello,

I am having difficulties in writing a c++ prog that uses C code to send an icmp
packet (icmpapi.h, ipexport.h (used by icmpapi.h)).  This is what my code looks
like so far:



-------------------------------------
#include <iostream>
#include <windows.h>

extern "C" {
#include <icmpapi.h>
}

int main(){
using namespace std;
HANDLE icmp;
icmp = IcmpCreateFile();

cout << "hello";
return 0;
}
________________________________________________


It compiles but then i get an error that says:

_______________________________________________
hello.obj(hello)
Error 42: Symbol Undefined _IcmpCreateFile 0

--- errorlevel 1
_______________________________________________




Before i added the:
extern "C" 

I would get the error:

_____________________________________________________________________
hello.obj(hello)
Error 42: Symbol Undefined ?IcmpCreateFile  YGPAXXZ (void *stdcall
IcmpCreateFile (void ))

--- errorlevel 1
_____________________________________________________________________


Any insight would be greatly appreciated.  Is there a way to send a custom icmp
packet using C++ libraries?  This might help some.  The code for sending the
exact packet I need to send is already written in C for me, so ideally I would
like to write a C++ prog that does some extra work but also sends the icmp
packet (exactly as written in the already existing C code that I have).


Thank you,

David S


Feb 16 2005
↑ ↓ Jack <Jack_member pathlink.com> writes:
use the one I attached on this message (icmp.zip)

In article <cv1fro$2aht$1 digitaldaemon.com>, david says...
When i attempt:
dmc hello.cpp icmp.lib
it says:
Error 43:  Not a Valid Library File

The file is in the 'lib' directory and it does indicate that its attempting to
link the .lib file.  Do I just have a bad .lib file?  What about the icmp.dll
file?  Does the .lib file use the .dll file in the system32 folder?  I have one
in my system32 right now, so I am assuming I am ok there.

Thank you,

David

In article <cuif84$235e$1 digitaldaemon.com>, Jack says...
You have to link it together with the import library of icmp.dll. You can make
the import library yourself.
Start command prompt and type this:
implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or
C:\WINDOWS\system32\icmp.dll for winxp)

Just link it together when you compile your source:
dmc hello.cpp icmp.lib

or if you just compile the source only (with the -c option) and you would like
to link it yourself:
link hello.obj icmp.lib

In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...
Hello,

I am having difficulties in writing a c++ prog that uses C code to send an icmp
packet (icmpapi.h, ipexport.h (used by icmpapi.h)).  This is what my code looks
like so far:



-------------------------------------
#include <iostream>
#include <windows.h>

extern "C" {
#include <icmpapi.h>
}

int main(){
using namespace std;
HANDLE icmp;
icmp = IcmpCreateFile();

cout << "hello";
return 0;
}
________________________________________________


It compiles but then i get an error that says:

_______________________________________________
hello.obj(hello)
Error 42: Symbol Undefined _IcmpCreateFile 0

--- errorlevel 1
_______________________________________________




Before i added the:
extern "C" 

I would get the error:

_____________________________________________________________________
hello.obj(hello)
Error 42: Symbol Undefined ?IcmpCreateFile  YGPAXXZ (void *stdcall
IcmpCreateFile (void ))

--- errorlevel 1
_____________________________________________________________________


Any insight would be greatly appreciated.  Is there a way to send a custom icmp
packet using C++ libraries?  This might help some.  The code for sending the
exact packet I need to send is already written in C for me, so ideally I would
like to write a C++ prog that does some extra work but also sends the icmp
packet (exactly as written in the already existing C code that I have).


Thank you,

David S



Feb 17 2005
↑ ↓ david <david_member pathlink.com> writes:
Jack,
When I click on the link, the browser just hangs.  Could you please send the
file to david.b.salgado gmail.com.

Thank you,
David

In article <cv1mts$2ir0$1 digitaldaemon.com>, Jack says...
use the one I attached on this message (icmp.zip)

In article <cv1fro$2aht$1 digitaldaemon.com>, david says...
When i attempt:
dmc hello.cpp icmp.lib
it says:
Error 43:  Not a Valid Library File

The file is in the 'lib' directory and it does indicate that its attempting to
link the .lib file.  Do I just have a bad .lib file?  What about the icmp.dll
file?  Does the .lib file use the .dll file in the system32 folder?  I have one
in my system32 right now, so I am assuming I am ok there.

Thank you,

David

In article <cuif84$235e$1 digitaldaemon.com>, Jack says...
You have to link it together with the import library of icmp.dll. You can make
the import library yourself.
Start command prompt and type this:
implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or
C:\WINDOWS\system32\icmp.dll for winxp)

Just link it together when you compile your source:
dmc hello.cpp icmp.lib

or if you just compile the source only (with the -c option) and you would like
to link it yourself:
link hello.obj icmp.lib

In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...
Hello,

I am having difficulties in writing a c++ prog that uses C code to send an icmp
packet (icmpapi.h, ipexport.h (used by icmpapi.h)).  This is what my code looks
like so far:



-------------------------------------
#include <iostream>
#include <windows.h>

extern "C" {
#include <icmpapi.h>
}

int main(){
using namespace std;
HANDLE icmp;
icmp = IcmpCreateFile();

cout << "hello";
return 0;
}
________________________________________________


It compiles but then i get an error that says:

_______________________________________________
hello.obj(hello)
Error 42: Symbol Undefined _IcmpCreateFile 0

--- errorlevel 1
_______________________________________________




Before i added the:
extern "C" 

I would get the error:

_____________________________________________________________________
hello.obj(hello)
Error 42: Symbol Undefined ?IcmpCreateFile  YGPAXXZ (void *stdcall
IcmpCreateFile (void ))

--- errorlevel 1
_____________________________________________________________________


Any insight would be greatly appreciated.  Is there a way to send a custom icmp
packet using C++ libraries?  This might help some.  The code for sending the
exact packet I need to send is already written in C for me, so ideally I would
like to write a C++ prog that does some extra work but also sends the icmp
packet (exactly as written in the already existing C code that I have).


Thank you,

David S



begin 0644 icmp.zip M4$L#!!0`` `(``6(43)`O:J\<0$````(```(````:6-M<"YL:6+M5<%*PT`0 M?9'22]LT-O;20V'K0:L(VO:DEZ!8U%-13QX,H5UJ(#9IT _(,0C^ Y^H?^"Z M2<AN-B?QX*$#"\F;F<=DYNWDLP74 !UD%N^A8]_.7X,KSX_HC;-:>-2:(#D! M/K0J5\UE2+L$XRTGC$WLIDDA=39TZK*<4R3'G$[U<#9=1 LRD6_FA!&]IX'G MTB O3_5P/D.)+QCC# R>]4!7B^OYBV^-1T ..9WBX&Q-$91JD^K+(T;6A+7O M2*A/]'#&EH3*E+&.IKWP;<I<=D #)/N<2 (Y2T.,*OHOYZ^K\M?E_+60;T!G MR-*--C2T?^*0''"&$IQ^B1Q9; ZSKW<-6_M79K+39V?(W\[Q")REGDO &;C# MTE3O/<FW 2AGT 5:HK)('VU9)V0 :[<'68NL$G4MU-6[:*"LP,%VE+^U6?XP MS`61V06F?8R?.LI$2!W9_,7%2AHH+3DV*6)(F A(K^H_HJ%B?3<J5F9W.ZX_ MM&]02P$"%``4``(`"``%B%$R0+VJO'$!````"```"````````````"`````` A````:6-M<"YL:6)02P4&``````$``0`V````EP$````` ` end

Feb 18 2005
↑ ↓ → Jack <Jack_member pathlink.com> writes:
I keep receiving the message "delivery failure" while trying to send the file to
your email. So I just upload the file at here:
http://www.freewebs.com/jackliew/icmp.zip


In article <cv4bac$2981$1 digitaldaemon.com>, david says...
Jack,
When I click on the link, the browser just hangs.  Could you please send the
file to david.b.salgado gmail.com.

Thank you,
David

In article <cv1mts$2ir0$1 digitaldaemon.com>, Jack says...
use the one I attached on this message (icmp.zip)

In article <cv1fro$2aht$1 digitaldaemon.com>, david says...
When i attempt:
dmc hello.cpp icmp.lib
it says:
Error 43:  Not a Valid Library File

The file is in the 'lib' directory and it does indicate that its attempting to
link the .lib file.  Do I just have a bad .lib file?  What about the icmp.dll
file?  Does the .lib file use the .dll file in the system32 folder?  I have one
in my system32 right now, so I am assuming I am ok there.

Thank you,

David

In article <cuif84$235e$1 digitaldaemon.com>, Jack says...
You have to link it together with the import library of icmp.dll. You can make
the import library yourself.
Start command prompt and type this:
implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or
C:\WINDOWS\system32\icmp.dll for winxp)

Just link it together when you compile your source:
dmc hello.cpp icmp.lib

or if you just compile the source only (with the -c option) and you would like
to link it yourself:
link hello.obj icmp.lib

In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...
Hello,

I am having difficulties in writing a c++ prog that uses C code to send an icmp
packet (icmpapi.h, ipexport.h (used by icmpapi.h)).  This is what my code looks
like so far:



-------------------------------------
#include <iostream>
#include <windows.h>

extern "C" {
#include <icmpapi.h>
}

int main(){
using namespace std;
HANDLE icmp;
icmp = IcmpCreateFile();

cout << "hello";
return 0;
}
________________________________________________


It compiles but then i get an error that says:

_______________________________________________
hello.obj(hello)
Error 42: Symbol Undefined _IcmpCreateFile 0

--- errorlevel 1
_______________________________________________




Before i added the:
extern "C" 

I would get the error:

_____________________________________________________________________
hello.obj(hello)
Error 42: Symbol Undefined ?IcmpCreateFile  YGPAXXZ (void *stdcall
IcmpCreateFile (void ))

--- errorlevel 1
_____________________________________________________________________


Any insight would be greatly appreciated.  Is there a way to send a custom icmp
packet using C++ libraries?  This might help some.  The code for sending the
exact packet I need to send is already written in C for me, so ideally I would
like to write a C++ prog that does some extra work but also sends the icmp
packet (exactly as written in the already existing C code that I have).


Thank you,

David S





Feb 19 2005