Hi Sparro,
I think below example may be useful.
Source of C: hari.c
File . , Record 'hari.c'
Command->
0001 #include <stdio.h>
0002
0003 void pri(int i)
0004 {
0005 printf ("Received value from jBASE is %d \n",i);
0006 }
Compile the C source and create a lib for it.
>jcompile hari.c -d -s libhari.so
Souce of BASIC: Basic.b
File PACS.BP , Record
'Basic.b'
Insert 13:01:42
Command->
0001 PROGRAM Basic
0002 DEFCE pri(INT)
0003
0004 PRINT "After execution of C function ": pri(2)
0005 END
Compile the BASIC code with the linking of above C library with the below
command.
> jcompile Basic.b -L. -l hari
Execute the program name.
$ ./Basic
Received value from jBASE is 2
After execution of C function 32
$
On 6 September 2012 18:57, Sparro <[email protected]> wrote:
> I have a couple C functions I'd like to be able to add to my BASIC
> programs without having to use the jbc command manually (I really like
> JED). So here's a test scenario:
>
> I have a C source file foo.c that contains function foo(STRING* stuff).
>
> I have a BASIC source file BAR.b that contains DEFC foo(STRING) and later
> on has foo("Hello, world!").
>
> If I compile an object for foo.c with jbc it complains that I have no
> 'main' function.
>
> If I compile BAR.b on its own it complains that it can't resolve foo().
>
> If I compile them both together from the command line with jbc it works
> fine, but that means I can't use JED to work with BAR.b and with the number
> of source files we have, that really isn't a workable solution.
>
> What do I need to do to make a library out of foo.c and where do I need to
> put it so that DEFC foo(STRING) can work without having to do command-line
> jiggery?
>
>
> --
> --
> IMPORTANT: T24/Globus posts are no longer accepted on this forum.
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
>
>
>
>
--
Thanks With Regards,
Duggineni Haribabu.
--
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en