ok lets say we will use dll's then
in MyProgram.h
the code goes:
what do i have to do with these files?Code:int foo(int *num); int foo2(int *gum);
resource.h
stdafx.h
assemblyinfo.cpp
stdafx.cpp
ok lets say we will use dll's then
in MyProgram.h
the code goes:
what do i have to do with these files?Code:int foo(int *num); int foo2(int *gum);
resource.h
stdafx.h
assemblyinfo.cpp
stdafx.cpp
Last edited by chico1st; 05-28-2008 at 09:42 AM.
assemblyinfo.cpp does not appear in native dlls.
They ONLY appear in dotNet projects.
In short, you have the wrong type of project!
stdafx.cpp/stdafx.h are for PCH, which you can use or ignore. They're very simply to use, really.
Resource.h is for resources, if you have any. Dialogs, menus, icons, etc.
does anyone know how to turn off .NET in MSVC++2005?
I disabled precompiled headers and deleted stdafx.cpp/stdafx.h/Resource.h
How am I supposed to setup MyProgram.h? Is it something like
that is all of my code.. there is nothing else.Code:__declspec(export) extern "C" int foo(int *num); __declspec(export) extern "C" int foo2(int *gum);
Yes, you must create an appropriate project.
All native projects, non-dotNet, are located under Win32.
Also, here's a DLL tutorial:
http://cboard.cprogramming.com/showp...9&postcount=16
It's for C++, though, but works fine for C.
Make SURE you have a proper project!
ok it turns out to make a Win32 DLL in MSVC++2005 you just make an empty project select DLL application type and start building it from there.
but i have many errors all of which come from my header. this is it in its entirety
Code:// Error display function __declspec(dllexport) void DisplayError(error); // // Callbacks __declspec(dllexport) int AnalogueCardInit(unsigned int *MegaMan); __declspec(dllexport) int AnalogueCardClose(int fire); __declspec(dllexport) int AnalogueCardGet(int width);
EDIT: ok for that to make sense I will have to post the actual functions (im not supposed to :P)Code:1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(6) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(6) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(6) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2059: syntax error : ',' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2059: syntax error : ')'
Code:// Error display function __declspec(dllexport) void DisplayError(Int32 error); // // Callbacks __declspec(dllexport) int AnalogueCardInit(SessHandle *Sess, InterHandle *Inter, int *Width, int *Height, uInt8 *image1D, uInt8 **image2D); __declspec(dllexport) int AnalogueCardClose(SessHandle *Sess, InterHandle *Inter); __declspec(dllexport) int AnalogueCardSnap(SessHandle Sid, uInt8 *ImaqBuffer, uInt32 top, uInt32 left, uInt32 height, uInt32 width);
Last edited by chico1st; 05-28-2008 at 12:52 PM.
__declspec(dllexport) void DisplayError(error);
missing type for the parameter
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
if i include the data types i get many more errors: I guess i will post those too. I thought it would be good to deal with one set of errors first but that might have been a bad ideaCode:1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(2) : error C2146: syntax error : missing ')' before identifier 'error' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(2) : error C2061: syntax error : identifier 'error' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(2) : error C2059: syntax error : ';' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(2) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2143: syntax error : missing ';' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2059: syntax error : 'type' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(6) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(6) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(6) : error C2143: syntax error : missing ';' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(6) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2146: syntax error : missing ')' before identifier 'Sid' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2061: syntax error : identifier 'Sess' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2059: syntax error : ';' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2059: syntax error : ',' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(7) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(95) : warning C4142: benign redefinition of type 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(95) : error C2370: 'InterHandle' : redefinition; different storage class 1> c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.h(5) : see declaration of 'InterHanle' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1274) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1274) : error C2081: 'InterHandle' : name in formal parameter list illegal 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1274) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1274) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1275) : error C2146: syntax error : missing ')' before identifier 'ifid' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1275) : error C2061: syntax error : identifier 'ifid' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1275) : error C2059: syntax error : ';' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1275) : error C2059: syntax error : ',' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1275) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1326) : error C2146: syntax error : missing ')' before identifier 'ifid' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1326) : error C2061: syntax error : identifier 'ifid' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1326) : error C2059: syntax error : ';' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\niimaq.h(1326) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(113) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(113) : error C2081: 'InterHandle' : name in formal parameter list illegal 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(113) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(113) : error C2059: syntax error : 'type' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(113) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(193) : error C2143: syntax error : missing ')' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(193) : error C2081: 'InterHandle' : name in formal parameter list illegal 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(193) : error C2143: syntax error : missing '{' before '*' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(193) : error C2059: syntax error : ')' 1>c:\documents and settings\desktop\imaq code\1.0\1.0.2dv3\dlltest\aquisition.c(194) : error C2054: expected '(' to follow 'Inter'
Last edited by chico1st; 05-28-2008 at 01:04 PM.
wow all 42 errors are gone! Thanks!
PS: Is your compiler a dog?
the compiler is (probably) barking at them.
No, an army sergeant that makes you knock it down when you forget to include headersIs your compiler a dog?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)