cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

DLL in Prime 3.0 with user-efi-dev-studio-project

JFPittet
3-Visitor

DLL in Prime 3.0 with user-efi-dev-studio-project

Hello,

I download the "User EFI Dev Studio Project" file from the discussion "The Down Low on Mathcad DLLs" from Aaron Shaw.

I have a question about the different function definition ...

In the "C:\Program Files\PTC\Mathcad Prime 3.0\Custom Functions\userpack.c" (or in the Help Centre - Custom Functions) the code is:

BOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved);

BOOL WINAPI DllEntryPoint (HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)

{ switch (dwReason)
{ case DLL_PROCESS_ATTACH:
{ // DLL is attaching to the address space of the current process.

if (!_CRT_INIT(hDLL, dwReason, lpReserved)) { return FALSE; }

if (!CreateUserErrorMessageTable( hDLL, 3, ErrorMessageTable ) ) break;
if ( CreateUserFunction( hDLL, &realsum ) == NULL ) break;
CreateUserFunction( hDLL, &transpose); break; }

In the "user-efi-dev-studio-project\User EFI Dev Studio Project\USERPACK - DevStudio Project\dllmain.cpp" the code is:

BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{ switch (ul_reason_for_call)
{ case DLL_PROCESS_ATTACH:
{ if (!CreateUserErrorMessageTable( hModule, 3, ErrorMessageTable ) ) break;
if ( CreateUserFunction( hModule, &realsum ) == NULL ) break;

CreateUserFunction( hModule, &transpose);
CreateUserFunction( hModule, &gmdate);
CreateUserFunction( hModule, &System);
break; }

I use the Visual Studio Prof 2010. I change all my files *.c in *.cpp, I change the "BOOL WINAPI _CRT ... BOOL WINAPI ... " in "BOOL APIENTRY ... ". I change all the DevStudio parameters exactly as the "User EFI Dev Studio Project" ...

... but the compiled DLL do not work. Prime does not load the compiled DLL.

I change back all the file in *.c, I change back to "BOOL WINAPI _CRT ... BOOL WINAPI ... " and I add the DllEntryPoint parameter in the "Linker-Advanced" property page.

The compiled DLL now works with Prime 3.0.

I wish understand the difference ... and which methode "BOOL WINAPI _CRT ... BOOL WINAPI ... " in "BOOL APIENTRY ... " is the best working methode.

Regards,

Jean-Francois

1 REPLY 1

Top Tags