Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Linking to DLL

Reply
Thread Tools

Linking to DLL

 
 
SirCodesALot
Guest
Posts: n/a
 
      06-12-2008
Dear great minds,

I am having trouble linking to an external dll and was wondering if
anyone out there could help. Here is my class

Istat.h
#include "afxdisp.h"

using namespace System;
using namespace System::Runtime::InteropServices;

class IStatus : public COleDispatchDriver
{

public:
IStatus() {} // Calls COleDispatchDriver default constructor


public:
//CString GetBstrVersion();
long GetNPort();

[DllImport("ComACRsrvr.dll")]

extern "C" {
void __stdcall Connect(long nTransport, long nIndex);
}
};

Istat.cpp: (relevate lines)
IStatus ParkerStage;
ParkerStage.Connect(3,0);

--------
The problem is when I compile. I have the ComACRsrvr.dll in the same
directory as the project, but when I compile i get the folling error
messages:
1>c:\\temp\Istat.h(32) : error C2059: syntax error : 'string'
1>c:\temp\Istat.h(32) : error C2334: unexpected token(s) preceding
'{'; skipping apparent function body

Could I be importing the library incorrectly or is there something I
am missing? Thanks in advance for your help!!!

-SJ
 
Reply With Quote
 
 
 
 
Erik Wikström
Guest
Posts: n/a
 
      06-12-2008
On 2008-06-12 20:56, SirCodesALot wrote:
> Dear great minds,
>
> I am having trouble linking to an external dll and was wondering if
> anyone out there could help. Here is my class
>
> Istat.h
> #include "afxdisp.h"
>
> using namespace System;
> using namespace System::Runtime::InteropServices;
>
> class IStatus : public COleDispatchDriver
> {
>
> public:
> IStatus() {} // Calls COleDispatchDriver default constructor
>
>
> public:
> //CString GetBstrVersion();
> long GetNPort();
>
> [DllImport("ComACRsrvr.dll")]
>
> extern "C" {
> void __stdcall Connect(long nTransport, long nIndex);
> }
> };
>
> Istat.cpp: (relevate lines)
> IStatus ParkerStage;
> ParkerStage.Connect(3,0);
>
> --------
> The problem is when I compile. I have the ComACRsrvr.dll in the same
> directory as the project, but when I compile i get the folling error
> messages:
> 1>c:\\temp\Istat.h(32) : error C2059: syntax error : 'string'
> 1>c:\temp\Istat.h(32) : error C2334: unexpected token(s) preceding
> '{'; skipping apparent function body
>
> Could I be importing the library incorrectly or is there something I
> am missing? Thanks in advance for your help!!!


You are writing C++/CLI and not C++ which makes it off topic in this
group, questions about DLLs are also off topic. You should try a MS
newsgroup (one in the microsoft.public.* hierarchy) or try asking in one
of the forums at http://forums.msdn.microsoft.com

--
Erik Wikström
 
Reply With Quote
 
 
 
 
SirCodesALot
Guest
Posts: n/a
 
      06-12-2008
On Jun 12, 2:00*pm, Erik Wikström <Erik-wikst...@telia.com> wrote:
> On 2008-06-12 20:56, SirCodesALot wrote:
>
>
>
>
>
> > Dear great minds,

>
> > I am having trouble linking to an external dll and was wondering if
> > anyone out there could help. Here is my class

>
> > Istat.h
> > #include "afxdisp.h"

>
> > using namespace System;
> > using namespace System::Runtime::InteropServices;

>
> > class IStatus : public COleDispatchDriver
> > {

>
> > public:
> > * *IStatus() {} * * * * * *// Calls COleDispatchDriver default constructor

>
> > public:
> > * *//CString GetBstrVersion();
> > * *long GetNPort();

>
> > * * * * * * * * [DllImport("ComACRsrvr.dll")]

>
> > * * * * * * * * extern "C" {
> > * * * * * * * * *void __stdcall Connect(long nTransport, long nIndex);
> > * * * * * * * * *}
> > };

>
> > Istat.cpp: (relevate lines)
> > IStatus ParkerStage;
> > ParkerStage.Connect(3,0);

>
> > --------
> > The problem is when I compile. I have the ComACRsrvr.dll in the same
> > directory as the project, but when I compile i get the folling error
> > messages:
> > 1>c:\\temp\Istat.h(32) : error C2059: syntax error : 'string'
> > 1>c:\temp\Istat.h(32) : error C2334: unexpected token(s) preceding
> > '{'; skipping apparent function body

>
> > Could I be importing the library incorrectly or is there something I
> > am missing? Thanks in advance for your help!!!

>
> You are writing C++/CLI and not C++ which makes it off topic in this
> group, questions about DLLs are also off topic. You should try a MS
> newsgroup (one in the microsoft.public.* hierarchy) or try asking in one
> of the forums athttp://forums.msdn.microsoft.com
>
> --
> Erik Wikström- Hide quoted text -
>
> - Show quoted text -


wow. thanks. I apologize for such an off topic post.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine if a DLL is a COM DLL or .NET DLL Anushi ASP .Net 5 10-28-2004 01:59 PM
not linking msvcr70.dll ASP .Net 0 08-11-2004 01:07 AM
Why does Ruby use both tcl83.dll and tk83.dll (instead of just tk83.dll)? H. Simpson Ruby 4 08-03-2004 04:45 PM
mprapi.dll --> samlib.dll --> ntdll.dll issue. Some1 Computer Support 4 04-05-2004 02:02 AM
msvcrt.dll, msvcirt.dll, msvcrt20.dll and msvcrt40.dll, explanation please! Snoopy NZ Computing 16 08-25-2003 12:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57