• 2 replies
  • Latest Post - ‏2010-06-20T20:09:06Z by GertW
15 Posts

Pinned topic Compiling DataPort Example with MS Visual Studio

‏2009-02-04T17:55:24Z |

I am following the DataPort example from ilogix to read out a StateMate project. I copied & pasted the given example, but it does not work. The source looks like this:

FONT=Courier New#include "C:/I-Logix/stmm/4.1/include/dataport.h"
#include <stdio.h>

main( )
int status, success;
char name32;
char dir30;
printf ("Enter name of Statemate project: ");
scanf ("%s", name);
printf ("Enter directory pathname for your Workarea: ");
scanf ("%s", dir);
success = COLOR=Redstm_init_uad (name, dir, automatic_transaction, &status);[/COLOR]
if (!success)
printf ("Init function failed. Reason: status code %d", status);

The compiler error is:
FONT=Courier Newmain.c(14): error C2197: 'stm_init_uad' : too many arguments for call through pointer-to-function[/FONT]

Does anyone have an idea? I would really appreciate it!


Have you defined the required environment variable DLL_LINK
to use the right function declaration under WINDOWS?
Updated on 2010-06-20T20:09:06Z at 2010-06-20T20:09:06Z by GertW
  • Bondbest
    1 Post

    Re: Compiling DataPort Example with MS Visual Studio

    I too am facing the same problem.Can you describe more about the environment settings and the detailed procedure of how to go about the compiling and linking.
  • GertW
    30 Posts

    Re: Compiling DataPort Example with MS Visual Studio

    I do not have a problem running this sample, using Visual Studio 6.0 and .Net 2003 on WinXP. Other compilers are not supported by Statemate.

    My makefile:
    my_prog.exe: my_prog.c
    cl -Zi -c my_prog.c /DDLL_LINK
    link my_prog.obj dataport.lib /out:my_prog.exe

    I set all environment variables in a batch file that are defined in run_stmm.bat and vcvars32.bat.
    Then I compile and run the dataport program from command line.
    Just type in
    nmake -f makefile
    It generates a my_prog.exe.