emb978@leah.Albany.Edu (Eric M. Boehm) (12/21/89)
I ran into a little problem while trying to recompile a multitasking demo from DDJ (by Tom(?) Green). The demo ran fine under Zortech 1.07 but now it doesn't link. I fixed the problem with calling assembler functions from c++ by using: extern "C" {...} However, the assembler file (timer.asm) wants to call: task_image far * task_control::task_switch(task_image far *, unsigned int, signal *); The problem is that name mangling creates an identifier 53 characters long and masm only accepts 31 character identifiers. I tried a hack (my apologies if this is obviously dumb) by: typedef task_image far * (*taskptr)(task_image far*, unsigned int, signal *); taskptr x = task_control::task_switch; The compiler first didn't like it because the function was private. I made it public and then it was a syntax error (expected '(' after task_switch). I haven't looked yet at the proper way to declare pointers to member functions (which is probably why I got a syntax error) but I don't think that will work since Zortech 2.0 doesn't support pointers to members. Any solutions (obvious or otherwise) would be appreciated. -- Eric M. Boehm EMB978@leah.Albany.EDU EMB978@ALBNYVMS.BITNET
bright@Data-IO.COM (Walter Bright) (12/23/89)
In article <2343@leah.Albany.Edu> emb978@leah.Albany.Edu (Eric M. Boehm) writes: <However, the assembler file (timer.asm) wants to call: < task_image far * task_control::task_switch(task_image far *, unsigned < int, signal *); <The problem is that name mangling creates an identifier 53 characters <long and masm only accepts 31 character identifiers. What version of MASM are you using? Do all MASMs suffer from this? I know that MS-LINK doesn't have any problem with it. You can solve the problem by writing a "wrapper" function: extern "C" task_image far *wrapper(task_control *p, task_image far *t, unsigned u, signal *s) { return p->task_switch(t,u,s); } and having your asm routine call it instead.