creating a function prototype for a DLL entry point

L

Lynn McGuire

I am creating a function prototype for a DLL entry point. I dynamically
load the DLL at runtime and then map the entry points.

typedef SP_STATUS SP_API (* myRNBOsproReadProc)
( SP_IN RBP_SPRO_APIPACKET packet,
SP_IN RB_WORD address,
SP_OUT RBP_WORD data );

myRNBOsproReadProc myRNBOsproRead;

This worked OK with Watcom C++. However, Visual C++ 2003 is
giving me a weird error message:

x.cpp(46): error C2059: syntax error : '('

I removed the parenthesis and then Visual C++ gives me:

x.cpp(49): error C2165: 'left-side modifier' : cannot modify pointers to data

Does anyone understand what is going on here ?

Thanks,
Lynn McGuire
 
M

mlimber

Lynn said:
I am creating a function prototype for a DLL entry point. I dynamically
load the DLL at runtime and then map the entry points.

typedef SP_STATUS SP_API (* myRNBOsproReadProc)
( SP_IN RBP_SPRO_APIPACKET packet,
SP_IN RB_WORD address,
SP_OUT RBP_WORD data );

Depending on what your macros evaluate to, this may or may not be
compiler-specific code.
myRNBOsproReadProc myRNBOsproRead;

This worked OK with Watcom C++. However, Visual C++ 2003 is
giving me a weird error message:

x.cpp(46): error C2059: syntax error : '('

I removed the parenthesis and then Visual C++ gives me:

x.cpp(49): error C2165: 'left-side modifier' : cannot modify pointers to data

Does anyone understand what is going on here ?

No, mostly because we don't have sufficient information. See this FAQ
on posting code that doesn't work correctly:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

You might also want to try a Microsoft-specific group (see the partial
list in
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9).

Cheers! --M
 
J

Jim Langston

Lynn McGuire said:
I am creating a function prototype for a DLL entry point. I dynamically
load the DLL at runtime and then map the entry points.

typedef SP_STATUS SP_API (* myRNBOsproReadProc)
( SP_IN RBP_SPRO_APIPACKET packet,
SP_IN RB_WORD address,
SP_OUT RBP_WORD data );

myRNBOsproReadProc myRNBOsproRead;

This worked OK with Watcom C++. However, Visual C++ 2003 is
giving me a weird error message:

x.cpp(46): error C2059: syntax error : '('

In VC++ 2003 this usually means that the compiler didn't understand what
went BEFORE the (. SP_STATUS or SP_API is likely undefined.
 
L

Lynn McGuire

typedef SP_STATUS SP_API (* myRNBOsproReadProc)
In VC++ 2003 this usually means that the compiler didn't understand what went BEFORE the (. SP_STATUS or SP_API is likely
undefined.

I moved the SP_API inside the parenthesis and it worked. SP_API
is defined as _stdcall. SP_STATUS is defined as unsigned short int.

This was suggested to me on news://comp.os.ms-windows.programmer.win32 .

Thanks,
Lynn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top