473,320 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

creating a function prototype for a DLL entry point

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
Jan 3 '07 #1
3 2970
Lynn McGuire wrote:
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-lit...t.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-lit....html#faq-5.9).

Cheers! --M

Jan 3 '07 #2

"Lynn McGuire" <no****@nospam.comwrote in message
news:12*************@corp.supernews.com...
>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.
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


Jan 4 '07 #3
> typedef SP_STATUS SP_API (* myRNBOsproReadProc)
> ( SP_IN RBP_SPRO_APIPACKET packet,
SP_IN RB_WORD address,
SP_OUT RBP_WORD data );
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
Jan 4 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Roy Hills | last post by:
I've seen two different function prototype formats used for ANSI C, and I'm unsure as to which is the correct or preferred one. 1st Format (this is what I use) type function(type, type, type);...
8
by: Johnny | last post by:
Hi, Is there a way to detect the entry point of all the functions in a project? If so, can I make a function that will be called at the every entry point? Thanks for your consideration. ...
5
by: Rymfax | last post by:
I have an application that will be used on both XP and Vista. One of the things this application needs to do is determine the exact operating system it is on. To get the correct "flavor" of Vista...
3
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I am a developer from C++ COM to C# COM. I feel confused about the entry point function for a C# COM object. In C++, we always initialize object through GetClassObject or...
0
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I have built MSDN OLE DB Sample Provider and successfully built/debug it using Microsoft Excel as client. I have found that in DllGetClassObject (classfac.cpp), the class...
2
by: FFrozTT | last post by:
I am having a problem creating a DLL with an entry point. I've been trying sub Main, DllMain, and I get nothing. When I run dumpbin - exports mydll.dll I see no entry points, also the dll when...
8
by: George2 | last post by:
Hello everyone, For entry point of a console application, http://msdn2.microsoft.com/en-us/library/f9t8842e(VS.71).aspx My understanding is it is important that the name of the function...
29
by: Ravishankar S | last post by:
Dear C Experts, While prepating a content for a C course,I made section on function prototypes. Could you kindly provide me your comments on its correctness. Thank you ! Q12: What is the...
1
by: Anouar Seljouki | last post by:
1) I built and application that I called contact here is the script for it using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Contacts...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.