unmanaged code in VC++.net

R

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
 
G

Guest

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*.
 

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

Top