Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!crdgw1!rpi!leah!emb978 From: emb978@leah.Albany.Edu (Eric M. Boehm) Newsgroups: comp.lang.c++ Subject: Calling C++ functions from MASM using Zortech 2.0 Keywords: MASM, name mangling, Zortech, C++ Message-ID: <2343@leah.Albany.Edu> Date: 20 Dec 89 23:57:10 GMT Organization: The University at Albany, Computer Services Center Lines: 35 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