jcl@bdrc.UUCP (John C. Lusth) (08/02/88)
I now have my C program compiling successfully under the compact and large memory models of MSC 5.0. Thanks to K. Heuer and M. Hunter for their advice. However, a more challenging adventure lies ahead in my journey into PC-land. I need to interface my mini-expert system with a database program that is being written in Microsoft's QuickBasic 4.0. Unfortunately, the integration is to be done many many miles from me, and I don't yet have access to a BASIC compiler (interpreter?). But it's my responsibility to tell the integrators how to call my routines from their code. So I need some help. Assuming the C modules are compiled under the large memory model, here are some representative C routine prototypes and my best guess at the BASIC declarations that are necessary to call them: 1) void esinit () DECLARE SUB Esinit CDECL () 2) int esstart () DECLARE SUB Esstart% CDECL () These are easy. Now a slightly more complicated call: 3) void estrace (int level) DECLARE SUB Estrace CDECL (BYVAL LEVEL AS INTEGER) A call with a string 4) int esreadkb (char *filename) DECLARE SUB Esreadkb% CDECL (SEG NAME AS STRING) and one with a string and two integers whose values need to be modified 5) void esvalue (char *var, int *value, int *set); DECLARE SUB Esvalue CDECL (SEG VAR$, SEG VALUE%, SEG SET%); Are these declarations correct? The last two make me uneasy, especially the string passing, since I think BASIC has real strings while C does not. Will the do-hickey which rearranges the order of the arguments on the stack also patch up strings so they will be compatible? Instead of all these function calls, I truly would like to use my top level varargs routine jess () to simplify the integration. jess () takes an integer code which tells the routine how many and what type of arguments to expect. But I have the feeling that it is impossible to call a varargs function from BASIC. Am I right in my thinking? John C. Lusth Becton Dickinson Research Center Research Triangle Park, NC 27278 ...!mcnc!bdrc!jcl