Linking libraries without links breaks my program

I have a post-processing program that interacts with Abaqus. The program works great with Abaqus 6.9 EF1. I want to update the program for working with Abaqus 6.12. I’m out of luck with the fact that the program works with an updated API.

I updated the list of libraries for communication in Visual Studio 2010. Everything builds and links correctly. When I run the program, I get the following message before pressing main :

Error message

Since the program is large (> 120k lines), I decided to return to the basics. The simple program below works fine until I call delete . As soon as I call delete , I get the same error message. If I do not connect to the Abaqus libraries, the program starts completely.

 #include <iostream> int main( int argc, char* argv[] ) { std::cout << "Hello world" << std::endl; int *p; p = new int(3); std::cout << *p << std::endl; delete p; return 0; } 

To clarify:

Case 1 Does not contact Abaqus libraries. It works well.

Case 2 Link to Abaqus Libraries. Throws a "Debug" error message.

Bottom line : I don't understand how linking, but not using their libraries breaks a simple program.

In my previous problems with Abaqus, I made sure that they created their own new and delete . Can their new version be called while the standard delete version is called? If so, is it their way to resolve the scope of these functions?

+4
source share
1 answer

It turns out that Abaqus defines its own operator new and operator delete in the global namespace. Thus, I was unknowingly associated with their implementation of operator new .

However, Visual Studio is associated with the definition of Abaqus operator new , and not with the definition of Abaqus operator delete . Instead, Visual Studio refers to the standard definition of operator delete .

These functions cannot be used interchangeably, so I get an error message. However, since Abaqus has placed its operator new and operator delete functions in the global namespace, I believe that I have no control over which function is connected.


Update: The above is only partially correct. Abaqus defines its own operator new , but they do not match operator delete - at least in the global namespace.

Therefore, Visual Studio cannot reference the corresponding Abaqus operator delete , because it does not exist.

0
source

Source: https://habr.com/ru/post/1487518/


All Articles