Solved

call libpcap functions

Posted on 2006-11-14
5
612 Views
Last Modified: 2008-02-01
hi,

i found all sorts of information of how to call libpcap functions from C/C++ but i can't find anything usefull on calling libpcap functions from free pascal (lazarus)
we could use tcpdump output in a memorystream, but we rather work with libpcap itself.

grtz
0
Comment
Question by:Commsquare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 6

Expert Comment

by:My name is Mud
ID: 17940058
Do you know the structure of the external fuctions/procedures, Have you try...

procedure ProcName(VarName: VarType); external; $L PROC.OBJ
0
 

Author Comment

by:Commsquare
ID: 17945129
hi whatboy,

the libpcap functions are written in C.
I can only find examples using libpcap using the C language.
they include the libpcap headers in C like this: #include <pcap.h>
and a function call is like this: dev = pcap_lookupdev(errbuf);

but i don't know if it is possible to call a C function in free pascal.
we're also developing in GNU/Linux so a dll with C code is no option.

also, what does $L PROC.OBJ mean?



0
 
LVL 6

Accepted Solution

by:
My name is Mud earned 250 total points
ID: 17946891
I didn't catch the "free pascal" thing... I never have use free pascal. but in borland pascal you can link to external libraries by compiling to *.OBJ, those can be asm or C.

and the $L instruct the compiler to link the specified obj file to your program...


Like in an ASM file you declare this...

DATA  segment  word public use16
      extrn    RotAngle:WORD
      extrn    TiltAngle:WORD
      extrn    Xt, Yt, Zt : DWORD
      extrn    _3DX, _3DY, _3DZ : DWORD
      extrn    _2DX, _2DY : DWORD
      extrn    CenterX, CenterY : DWORD
      extrn    SinTab:BYTE
      extrn    CosTab:BYTE
      extrn    ObserverX, ObserverY, ObserverDist : DWORD
      extrn    TmpEqu:DWORD
      extrn    Perspective:BYTE
      extrn    ZoomFactor:WORD
      extrn    CameraX, CameraY, CameraZ : DWORD
DATA  ends

CODE  segment  byte public use16
      assume   ds:DATA,cs:CODE

      public   IntMapCoordinates
      public   IntMapCoordinates2

IntMapCoordinates proc far
  .
  .
  .
IntMapCoordinates endp

IntMapCoordinates2 proc far
  .
  .
  .
IntMapCoordinates2 endp


And in your pascal program you put...

{$L engine3d}

Procedure IntMapCoordinates;external;
Procedure IntMapCoordinates2;external;
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Let's recap what we learned from yesterday's Skyport Systems webinar.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question