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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to use my external DLL in X-Function?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Alex-qwerty

Russia
Posts

Posted - 12/05/2010 :  03:39:57 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 8.1 SR3 Operating System: WinXP SP3
I have my own DLL that I can use in OriginC, and I can use it in OriginC.
Files "MyDLL.dll" and "MyDLL.h" are located in the same folder as my Origin project that uses this DLL. But functions from my DLL are accessible just from this project.
Now I want to use this DLL in my user X-Function, for accessing my DLL functions fron any project.
Is it possible?
I tried to compile my X-Function, but have compiler message:
"Error, include file not found"
I try to put include file "MyDLL.h" as in folders with my X-Function:
"...\Documents and Settings\...\OriginLab\81\User Files\X-Functions\Miscellaneous\"
as in folders:
"C:\Program Files\OriginLab\Origin81\OriginC\OriginLab\"
"C:\Program Files\OriginLab\Origin81\OriginC\System\"
but always get message "Error, include file not found".
Is there a way to use my DLL in user X-Function?

Alex-qwerty

Russia
Posts

Posted - 12/06/2010 :  01:09:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
One of cases abowe start working after Origin restart:
I put file "MyDLL.h" in
C:\Program Files\OriginLab\Origin81\OriginC\Systemand "MyDLL.dll" in
C:\Program Files\OriginLab\Origin81and type in my X-Function #include <MyDLL.h>
and restart Origin.
After that my X-Function begin to compile and work normally.
But all these folders are Origin system folders.
So, the qwestion now is: Is there a way to use a Origin user folders for storing "MyDLL.h" and "MyDLL.dll"?
Go to Top of Page

Penn

China
644 Posts

Posted - 12/06/2010 :  02:23:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please refer to our Origin C document about how to Include Header Files and Access an External DLL.

In your issue, you can try to put both your "MyDLL.h" and "MyDLL.dll" in the folder "OriginC\X-Functions", which is under the User Files Folder. In the "MyDLL.h" header file, need the following line to specify the location of the dll.

#pragma dll(MyDLL, header) //in the same folder as this .h file

Then in the X-Function, include the header file like:

#include "MyDLL.h"


Penn
Go to Top of Page

Alex-qwerty

Russia
Posts

Posted - 12/06/2010 :  10:42:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Many thanks for Penn!
It works!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000