Topic
2 replies Latest Post - ‏2010-06-20T20:09:06Z by GertW
SystemAdmin
SystemAdmin
15 Posts
ACCEPTED ANSWER

Pinned topic Compiling DataPort Example with MS Visual Studio

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

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);
}[/FONT]

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!

Answer:

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
    Bondbest
    1 Post
    ACCEPTED ANSWER

    Re: Compiling DataPort Example with MS Visual Studio

    ‏2010-06-05T07:26:14Z  in response to SystemAdmin
    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
    GertW
    29 Posts
    ACCEPTED ANSWER

    Re: Compiling DataPort Example with MS Visual Studio

    ‏2010-06-20T20:09:06Z  in response to SystemAdmin
    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.

    Gert