Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dll dilemmas...

Status
Not open for further replies.

ahoodin

Programmer
Jul 25, 2001
48
0
0
US
I have a dll function that parses out a substring.
It doesn't work when I call it using the dll.
pointer to char pRetval comes back as the first substring always.

When I move the function out of the dll and put it in one
of the cpp files the function works just fine.
pRetval comes back as the substring I requested.

What is going on?

Asher
 
May be a problem during Link Phase. In faq101-993 there is an example for network programming with winsock dll. In this routine the DLL functions are initialized during Runtime. Perhaps this example may help you.


hnd
hasso55@yahoo.com

 
Well to fill you in, I am linking the dll in with the compiler in linker options, calling out the lib. The
functions i am using are called throughout the project, explicit linking methods are not neccesary.

I believe it is a scoping issue.

FWIW,
Asher
 
I think u haven't declared the function in ur CPP file

suppose ur function is

void Substring(); in DLL

please do the following in the CPP file where u r using the function

extern _C _declspec(_dllimport) void Substring();

I hope this will help u

 
I do already include a header file with the declaration.
-A
 
If I remember correct Substring is the name of a library Function. Perhaps you should change the name of that function.


hnd
hasso55@yahoo.com

 
That is not the name of the function.
I have solved my problems.
Thanks for your time and attn.
-A
 
well the problem was:

*I have a dll function that parses out a substring.
It doesn't work when I call it using the dll.
pointer to char pRetval comes back as the first substring always.*


But since I took the include statement out of the stdafx.h and moved it to the source file, I dont have the problem anymore. For some reason some of the link files dont get created if you put your #include in the stdafx.h.

Any Ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top