MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / DllEntryPoint

Function DllEntryPoint

wrappers/MathCAD/CoolPropMathcad.cpp:1003–1042  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001#endif
1002
1003extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) {
1004 switch (dwReason) {
1005 case DLL_PROCESS_ATTACH:
1006 //
1007 // DLL is attaching to the address space of the current process.
1008 //
1009 if (!_CRT_INIT(hDLL, dwReason, lpReserved)) return FALSE;
1010
1011 // Register the error message table
1012 if (!CreateUserErrorMessageTable(hDLL, NUMBER_OF_ERRORS, CPErrorMessageTable)) break;
1013
1014 // ...and if the errors register OK, go ahead and register user function
1015 CreateUserFunction(hDLL, &PropsParam);
1016 CreateUserFunction(hDLL, &FluidParam);
1017 CreateUserFunction(hDLL, &RefState);
1018 CreateUserFunction(hDLL, &Props1SI);
1019 CreateUserFunction(hDLL, &PropsSI);
1020 CreateUserFunction(hDLL, &PropsSImulti);
1021 CreateUserFunction(hDLL, &PhaseSI);
1022 CreateUserFunction(hDLL, &HAPropsSI);
1023 CreateUserFunction(hDLL, &GetMixtureData);
1024 CreateUserFunction(hDLL, &SetMixtureData);
1025 CreateUserFunction(hDLL, &ApplyMixingRule);
1026 // Register the new helper functions for predefined mixtures
1027 CreateUserFunction(hDLL, &GetPredefFluids);
1028 CreateUserFunction(hDLL, &GetPredefMoleFracs);
1029 break;
1030
1031 case DLL_THREAD_ATTACH:
1032 case DLL_THREAD_DETACH:
1033 case DLL_PROCESS_DETACH:
1034
1035 if (!_CRT_INIT(hDLL, dwReason, lpReserved)) {
1036 Sleep(1000); // Attempt to keep CRT_INIT from detaching before all threads are closed
1037 return FALSE;
1038 }
1039 break;
1040 }
1041 return TRUE;
1042}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected