I would like to execute a FreeBasic function from my C code. (GCC 5.1 for dos --> C / C++)
My C code produce a .A library that I use into my freebasic code.
Example, FreeBasic code :
Code: Select all
Declare function abc(a as integer, b as integer) as integer
function abc(a as integer, b as integer) as integer
dim result as integer = a + b
abc = result
end function
- Method 1When I compile, freebasic compiler return "undefined reference to 'abc(int, int)'"
Code: Select all
extern int abc(int a, int b); int result; result = abc(123, 150);
I tested with ABC(int, int) , _abc(int, int) or _ABC(int, int) .. Same problem
- Method 2
When I compile my freebasic code, my abc() function is called "_ABC" in asm code
so, in my C code i test :this works but with random value for a and b variablesCode: Select all
asm("call _ABC");
So i test thiscrash... SIGSEGV signalCode: Select all
asm("push 123"); // a asm("push 150"); // b asm("call _ABC");
Thank you