473,398 Members | 2,165 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,398 software developers and data experts.

unmanaged code in VC++.net

rb
Hi

I am trying to write an unmanaged C++ program using
VS.NET 2003. Its giving some errors. So, my question is
can we write unmanaged code in C++. This is the program I
wrote. Can you suggest me some material which I can refer
for this?

#include <iostream>

using namespace std;

BOOL __stdcall DllMain(HINSTANCE hInst, DWORD dwReason,
LPVOID lpReserved)

{

return TRUE;

}

extern "C" __declspec(dllexport) int GetIntegerA()

{

return 23;

}

The error I am getting is

): error C2143: syntax error : missing ';'
before '__stdcall'

error C2501: 'BOOL' : missing storage-class or type
specifiers

error C2065: 'HINSTANCE' : undeclared identifier

error C2146: syntax error : missing ')' before
identifier 'hInst'

warning C4229: anachronism used : modifiers on data are
ignored

error C2501: 'DllMain' : missing storage-class or type
specifiers

error C2059: syntax error : ')'

error C2143: syntax error : missing ';' before '{'

error C2447: '{' : missing function header (old-style
formal list?)

Any help is appreciated,

thanks

Nov 17 '05 #1
1 2873
BOOl, HINSTANCE, DWORD and LPVOID are not defined by default. Including windows.h will define these types. Another option is to use standard types like bool, int and void*.
Nov 17 '05 #2

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

Similar topics

2
by: Weston Fryatt | last post by:
(Sorry for spamming multiple groups, But I need a solution to this problem) I think this should be a simple question on Memory Allocation in a managed DLL and passing a memory pointer over to an...
1
by: Omid Hodjati | last post by:
Hi All, I have an old unmanaged code written in C++ 6.0. This is a time critcal, CPU bound application. I have deciede migrate this application to managed world and VC++ 7.0. The first step was...
2
by: | last post by:
Everything seems to be moving to .NET and VC++ seems to be adding a lot of managed code support every new release. The questions: is unmanaged code in VC++ beeing phased out in favour of managed...
4
by: | last post by:
I am stuck in a situation and I do believe that this should work, but it doesn't. I have a unmanaged dll, that uses MFC. This works great. Now I recompile the unmanaged dll so it contains...
0
by: DotNetJunkies User | last post by:
Background: I am creating a VC++ .NET wrapper for a C++ DLL; the aim is to use this wrapper in C# as shown below: Range r = new Range( 2, 2 ); r = new Cell( “Hello Mum” ); Range is a...
2
by: J | last post by:
Compiling a straight C++ module under VC++ 7 would seem to autogen an 'IJW' type .NET module, even if the module has standard VC++ syntax. I'm assuming that the 'unmanaged' flag would have no...
6
by: Olaf Baeyens | last post by:
The new Visual C++ 2005 is coming out in a theater near you. :-) Just a few questions: * How will the users that use my program upgrade to the .NET framework 2.0? My current users already refuse...
3
by: Thorsten | last post by:
HI I'm a C# developer and unfortunately I have to write now some code in managed and unmanaged C++. In this area I'm Newbie and therefore please forgive me if this is a really simple...
5
by: Andy | last post by:
I'm having trouble accessing an unmanaged long from a managed class in VC++.NET When I do, the contents of the variable seem to be mangled. If I access the same variable byte-by-byte, I get the...
3
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.