Hi 
You can write in a single PRG file, both harbour program e C function. 
Here's the RND fucntion example: 


function Main()
clear screen
for k=1 to 10
? rnd(6)
next k
return NIL



#pragma BEGINDUMP
HB_FUNC(RND) {
hb_retni(rand()%hb_parni(1)+1);
}
#pragma ENDDUMP


Here's another example of function without parameters:


function Main()
clear screen
? stampa()
return nil



#pragma BEGINDUMP
#include 
HB_FUNC(STAMPA) {
unsigned int a,b,c;
a=16;
b=5;
c=a+b;
hb_retni(c);
}
#pragma ENDDUMP



Here's another example of function WITH parameters:


function Main()
clear screen
? moltiplicazione(58,37)
return nil


#pragma BEGINDUMP
#include 
HB_FUNC(MOLTIPLICAZIONE) {
unsigned int a,b,c;
a=hb_parni(1);
b=hb_parni(2);
c=a*b;
hb_retni(c);
}
#pragma ENDDUMP



Hi hope to helped you. 
Giovanni Di Maria








Hi All 



I am a new user looking for a hand hold. 



I have 

1. a Clipper prg file 

2. and a C file 



What I want to do is write a function in the C file and have that C function 
available to use in my prg file. Using HBMK2 HBC and HBP files. 



Does anyone have a VERY simple example of how to do this? Along with the steps 
onhow to do this. 



I have already converted and completed creating a Harbour exe from my old 
clipper program Using HBMK2 HBC and HBP files now I want to add a C function. 



Many thanx 



Randy



_______________________________________________
Harbour-users mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour-users

Reply via email to