Click here to Skip to main content
15,888,293 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,
I am trying to access my API functions from DLL file. but getting this error
"The program has unexpectedly finished."
C:\MyDevelopment\build-PcanPortLinker-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug\PcanPortLinker.exe crashed

My DLL file config is as following.

LIBS += "C:/MyDevelopment/PcanLinker/build-PcanPortLinker-Desktop_Qt_5_5_0_MinGW_32bit-Debug/debug/PCANBasic.dll"

Any help/suggestion/experience sharing would be appreciated.
Thanks
Posted
Comments
Richard MacCutchan 2-Nov-15 4:55am    
You should not add the DLL to your LIBS variable. Add the corresponding .lib file.
Ramiien 2-Nov-15 5:04am    
you means lib file of the API?? how lib file access DLL file?
Richard MacCutchan 2-Nov-15 7:03am    
The .lib file contains the information about the external functions that the application needs. The linker adds these to the final project which provides the details for the Windows loader to find the relevant DLL at run time.
Ramiien 2-Nov-15 7:19am    
so i need to include only PCANBasic.lib file in my .pro file and place the PCANBasic.dll in the same folder.
e.g
#LIBS += "C:/MyDevelopment/PcanLinker/includes/PCANBasic.lib"
and PCANBasic.dll into the includes folder.
this what you means?
Richard MacCutchan 2-Nov-15 7:43am    
The DLL file needs to be in the same directory as the final exececutable, or one of the directories in the Windows' PATH environment variable.

1 solution

To really see what's going on, you need to run your program under the debugger, and when the exception occurs, trap it, and post the debugger info here.

i.e. Exception type, stack trace, source code on which the error occurs, etc.

then, we might be able to pinpoint your problem

gwk
 
Share this answer
 
Comments
[no name] 9-Nov-15 2:24am    
This is a comment not a solution.
griffwk 9-Nov-15 19:58pm    
well. without the info I outlined--you are almost certain to *never* get a complete solution...
[no name] 9-Nov-15 20:42pm    
Has nothing to do with my point - a request for information is not a solution and should not be posted as such.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900