Linking to DLL

S

SirCodesALot

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
 
E

Erik Wikström

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
 
S

SirCodesALot

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

wow. thanks. I apologize for such an off topic post.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top