|
Is there any known solution for dynamically compiling code, even simple one, for example to keep reasonable performance when evaluating a user-defined function in a graph application (instead of interpreting) ?
something like:
double (*fn)(double x) ;
...
fn = Compile("{return sin(x);}") ;
res = fn(3.14) ;
I've tried generating some assembly code from the expression and putting it in a char array that I can execute. This works, but it's platform specific and it's reinventing the wheel.
An other solution that I did not test would be to directly call the compiler and for example generate a dll you can call afterwards, but It's not really clean nor portable !
Any ideas for any clean solution ?
Application of that could also be a "compiling spreadsheet" etc...
Mooze
|
|
|
|
|
Well, C++ code is not interpreted, so there probably isn't a "clean" solution, not without re-inventing the wheel (as you say.) You could try embedding Perl or Python into your app.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
Yes, I could, and I actually did it in some cases, but it does not solve the (interpreting) performance problem. It seems .net allows some sort of dynamic compilation, but the whole thing remains interpreted as far as I understand.
Thanks anyway
|
|
|
|
|
I've never written a DLL before so this may be a dumb question. In a project I'm working on I'm wanting to put some of the functionality in a DLL. I created it using the MFC DLL Wizard, but I'm not sure if I'm going about creating it correctly. After it created it's base classes I added my own to the project and am adding my functionality to it. Is that correct or should I be adding everything to the classes it created? Also how do I go about using the DLL? Can I simply include the headers in my other project or will I have to use LoadLibrary and such? Thanks for the help.
- Aaron
|
|
|
|
|
There are 2 ways to export things from DLLs
1. Via DEF files
2. Via _declspec(import) & _declspec(export)
And there are two ways to get it into the client:
1. Via Implicit linking - IE with a .LIB file
2. Via Explict linking - IE LoadLibrary/GetProcaddress
Which you choose very much depends on what you want to do. For the most part, people use Implicit linking and DEF files - simply as DEF files make adding/removing functionality to/from the DLL easier.
If your a beginner, id stick to _declspec and implict linking.
Have a read of
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_using_implicit_linking.asp
To get you started.
|
|
|
|
|
Hi,
I am developing an application in win32.
My computer is in a network.
I want to get the list of all the computers connected in the network neighbourhood.
Is there any API to achieve this?
Pls guide?
|
|
|
|
|
Were you aware that you posted this twice?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I am developing an application in win32.
My computer is in a network.
I want to get the list of all the computers connected in the network neighbourhood.
Is there any API to achieve this?
Pls guide?
I am doing a multi threaded application that involves exchange of data.
ONE UI THREAD
AND 3 WORKER THREADS.PLS LET ME HOW TO EXCHANGE THE DATA BETWEEN THESE 3 WORKER THREADS.
FOR EX:THE FIRST THREAD WILL GIVE THE SECOND THREAD THE 2 NUMBERS AS ARGUEMENTS.the second thread should return the first thread the sum.
Pls help
|
|
|
|
|
ykutanoor wrote:
I want to get the list of all the computers connected in the network neighbourhood.
Is there any API to achieve this?
See my response to abdul here.
ykutanoor wrote:
I am doing a multi threaded application that involves exchange of data.
ONE UI THREAD
AND 3 WORKER THREADS.PLS LET ME HOW TO EXCHANGE THE DATA BETWEEN THESE 3 WORKER THREADS.
FOR EX:THE FIRST THREAD WILL GIVE THE SECOND THREAD THE 2 NUMBERS AS ARGUEMENTS.the second thread should return the first thread the sum.
Pls help
This was responded to here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a vector of CString objects that have up to a few hundred words in each CString. For each CString object is there a way in the STL to do something like in VB where I could say MyArray() = split(str,' ') Doing this in VB would fill the dynamic array with each substring that was found in between the spaces. Any help would be appreciated. Thanks In Advance
If it's broken, I probably did it
bdiamond
|
|
|
|
|
You could try implementing your own split function.
CStringArray Split (CString csWords, CString csOn)
{
int index;
CStringArray arr;
arr.SetSize (50);
while (csWords.GetLength () > 0) {
index = csWords.Find (csOn);
if (index == -1) break;
arr.Add (&(csWords.Left (index)));
csWords.Delete (0, index);
}
arr.Add (csWords);
retrun arr;
} I haven't tested it, but it should work.
- Aaron
|
|
|
|
|
thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I'm not sure of any single function that would do it, but perhaps AfxExtractSubString() could be used as a starting point.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi!
I am trying to accept a dropped CF_TEXT type... I _must_ use the COleDropTarget class for this. Unfortunately all classes and articles I found derive the OnDrop function from a CView... But I have a CTreeCtrl... I cannot use the OnDropFiles member, the incoming data is of type CF_TEXT.
How can I make my CTreeCtrl accept a drag-n-drop operation using COleDropTarget?
Thanks and best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
First thanks for your reply. I've read your article (excellent btw!), but somehow I cannot get this work...
I created a new, from COleDropTarget derived, class:
#include "StdAfx.h"
#include "EntryToGroupDrop.h"
CEntryToGroupDrop::CEntryToGroupDrop()
{
}
CEntryToGroupDrop::~CEntryToGroupDrop()
{
}
DROPEFFECT CEntryToGroupDrop::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
{
MessageBox(GetDesktopWindow(), "Test", "Test", MB_OK);
return DROPEFFECT_MOVE | DROPEFFECT_COPY;
}
DROPEFFECT CEntryToGroupDrop::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
{
return DROPEFFECT_MOVE | DROPEFFECT_COPY;
}
DROPEFFECT CEntryToGroupDrop::OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point)
{
return DROPEFFECT_SCROLL;
}
void CEntryToGroupDrop::OnDragLeave(CWnd* pWnd)
{
}
BOOL CEntryToGroupDrop::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
return TRUE;
}
Header file:
class CEntryToGroupDrop : public COleDropTarget
{
public:
CEntryToGroupDrop();
virtual ~CEntryToGroupDrop();
DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
void OnDragLeave(CWnd* pWnd);
BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
};
I want to make the treectrl a drop-target when the user starts dragging something from a clistctrl, which is right of the treectrl (an application like explorer):
void CTestDlg::OnBeginDragPwlist(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
*pResult = 0;
COleDropSource *pDropSource = new COleDropSource;
COleDataSource *pDataSource = new COleDataSource;
m_bDraggingEntry = m_dropEntryToGroup.Register(&m_cGroups);
TRY
{
CSharedFile fileShared;
TRY
{
CArchive ar(&fileShared, CArchive::store);
TRY
{
CString strData;
strData = "Test";
ar.Write((LPCTSTR)strData, strData.GetLength() + sizeof(TCHAR));
ar.Close();
}
CATCH_ALL(eInner)
{
ASSERT(FALSE);
}
END_CATCH_ALL;
}
CATCH_ALL(eMiddle)
{
ASSERT(FALSE);
}
END_CATCH_ALL;
pDataSource->CacheGlobalData(CF_TEXT, fileShared.Detach());
pDataSource->DoDragDrop(DROPEFFECT_MOVE | DROPEFFECT_COPY, NULL, pDropSource);
}
CATCH_ALL(eOuter)
{
ASSERT(FALSE);
}
END_CATCH_ALL;
SAFE_DELETE(pDataSource);
SAFE_DELETE(pDropSource);
if(m_bDraggingEntry != FALSE) m_dropEntryToGroup.Revoke();
}
The dragging works fine (I can drag the text into other windows), but the treectrl doesn't act as a drop target... The MessageBox in the OnDragEnter function isn't displayed...
Any idea what's wrong??
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I'm looking for software to do an "automated plane ticket search". ALL sites force you to give start/stop dates and do not allow ranges. I want to find the cheapest flight in a certain period and it looks like I'll need some code to do this. Unfortunately I have no idea on how to iterate on a web search page.
|
|
|
|
|
What do you good people do ? I need to run several different post build apps and a batch file seems a bit clunky. Any good ideas that fit with the VS.NET macros etc ?
|
|
|
|
|
I want to send a string to a process (exe) for some changes and return back to the calling process.
I cannot use WM_COPYDATA because it is only one way.
Any suggestion
Kiru
|
|
|
|
|
kirucodeproject wrote:
I cannot use WM_COPYDATA because it is only one way.
If window A can send the message to window B, then why can window B not send the same message to window A?
Have you looked into the other forms of IPC such as DDE, clipboard, mailslots, pipes, sockets.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks.
DLL which is plugged by some ODBC client can call the exe for string changes and wait for the changes and continue. Therefore, it cannot send message back. Can i use call back. dll -> launch an exe (createProcess)for the string change. Can the DLL call a callback function in exe?
|
|
|
|
|
Hi all.
I write a smale Win-App with VS.net 2003 (using MFC).
During testing I encounter a problem which should not exist (as M$ wrote @ MSDN)
After i open the Database (MS Access / SQL Server) and call the
SetLockingMode(CRecordset::pessimistic) to protect the Record.
As M$ wrote before ..calling the Edit() function.
But I allways get the Error message "Lockmode is not supported".
I had installed latest MS-SQL ODBC Drivers and using MS-Access 2003 as well MS-SQL Server 2000 SP4 but with both I encounter the same message.
Anybody have a idea what to do ??
Do I have to write my own Ttransactionserver which handle this ??
I think it's all M$-Product so interoperability should be no problem..
or I'm completly wrong in this case ???
Big THX: for any help regarding this problem (I'm sure I'm not the only one out there)
C'ya
Mantra
|
|
|
|
|
Nobody ??? Tought here are the real code-gurrus...
So I'm the only one with this problem or what ?
Cheerz
|
|
|
|
|
Dear Friends,
I am new to VC and would like to know how can I see the .lib file in my workspace window.
Please write to me and help me ASAP.
Thanking You
With Regards
Bilar
|
|
|
|