The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 problem about "extend origin C via enternal dll

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
xjsccs Posted - 05/09/2004 : 11:22:36 PM
an example that a dll created by C is given£¬ however£¬ when the file created by C£«£«£¬ the Origin can't find the function in the
enternal dll


#include <windows.h>
//#include <afxdao.h>
/*
DllMain is an optional method of entry into a dynamic-link library (DLL).
If the function is used, it is called by the system when processes and threads
are initialized and terminated, or upon calls to the LoadLibrary and
FreeLibrary functions.
*/
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

SimpleDll.c
__declspec(dllexport) int IncrementMatrix(double *pdMatrix, int iRows, int iCols, double dIncAmount)
{
int iRow, iCol;

for( iRow = 0; iRow < iRows; iRow++ )
{
for( iCol = 0; iCol < iCols; iCol++ )
{
*pdMatrix += dIncAmount;
pdMatrix++;
}
}

return 0;
}

ps£º can this C file be changed to C++ file, and then complied by c++ complier?
1   L A T E S T    R E P L I E S    (Newest First)
Iris_Bai Posted - 05/10/2004 : 06:02:36 AM
Hi Xue,

You can add
	extern "C" 
like the following:

extern "C" __declspec(dllexport) int IncrementMatrix(double *pdMatrix, int iRows, int iCols, double dIncAmount)


Iris

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000