Search found 11 matches

by MicroVirus
Mon Jun 18, 2012 5:37 am
Forum: Common Lisp
Topic: Separate lisp and foreign name for cffi defcstruct?
Replies: 3
Views: 6384

Re: Separate lisp and foreign name for cffi defcstruct?

Natively, there is nothing like type safety when calling C code. That's why each piece of C code that needs to use a shared library (for instance dll) needs the header file with the function definitions and type definitions. No such information is exported from the shared library; only the entry-poi...
by MicroVirus
Mon Jun 18, 2012 5:23 am
Forum: Common Lisp
Topic: Getting the directory of executable (like GetModuleFileName)
Replies: 10
Views: 16720

Re: Getting the directory of executable (like GetModuleFileN

Thanks for your responses. It's generally not desirable to have a function returning the location of the executable, because this opens the door and invites all virii of the internet to manipulate the executable. I don't understand what you mean with this. Any Windows executable can get its own loca...
by MicroVirus
Mon Jun 18, 2012 5:07 am
Forum: Common Lisp
Topic: Problem properly using defvar/defparameter/defconstant
Replies: 3
Views: 5661

Re: Problem properly using defvar/defparameter/defconstant

Thanks for the responses! I played around with it a bit and I think I'll be using the late binding suggestion, which seems most elegant to me.
by MicroVirus
Fri Jun 08, 2012 6:32 pm
Forum: Common Lisp
Topic: Problem properly using defvar/defparameter/defconstant
Replies: 3
Views: 5661

Problem properly using defvar/defparameter/defconstant

Dear Lispers, I'm having problems 'properly' using defparameter (or defvar or defconstant) in my code. Occasionally I find myself trying to code something like: (defparameter *functions* `((label1 . ,#'function1) (label2 ,#'other-function))) (defun function1 (something) ...) (defun other-function ()...
by MicroVirus
Fri Jun 08, 2012 6:22 pm
Forum: Common Lisp
Topic: Getting the directory of executable (like GetModuleFileName)
Replies: 10
Views: 16720

Re: Getting the directory of executable (like GetModuleFileN

Thanks for your reply. I'll try out *load-truename* as soon as I can. I am very curious if it is properly bound when using an executable created with saveinitmem.
by MicroVirus
Wed Jun 06, 2012 3:54 pm
Forum: Common Lisp
Topic: Getting the directory of executable (like GetModuleFileName)
Replies: 10
Views: 16720

Re: Getting the directory of executable (like GetModuleFileN

I managed to test it on Windows and you are right. All the described methods return the same thing: the current working directory. I've given up on getting the executable's directory for now, I'll just have to ensure the current working directory is properly set. I've now stumbled upon a new problem...
by MicroVirus
Mon May 28, 2012 6:35 am
Forum: Common Lisp
Topic: Getting the directory of executable (like GetModuleFileName)
Replies: 10
Views: 16720

Re: Getting the directory of executable (like GetModuleFileN

Thanks for your reply Edgar. Unfortunately, those both use the current working directory when the program starts, which (at least on Windows) is highly unpredictable and not a reliable method. If in the command line the user uses the following two ways to open the program, the results would differ: ...
by MicroVirus
Sun May 27, 2012 3:54 pm
Forum: Common Lisp
Topic: Structs in arrays
Replies: 3
Views: 8617

Re: Structs in arrays

This is a late reply, but just wanted to add one remark that you might find handy later on: Common Lisp is actually case-sensitive at its core. However, when you write a piece of code and then tell the lisp reader to read that piece of code, it upcases all the symbol names it encounters. For instanc...
by MicroVirus
Sun May 27, 2012 3:35 pm
Forum: Common Lisp
Topic: Getting the directory of executable (like GetModuleFileName)
Replies: 10
Views: 16720

Getting the directory of executable (like GetModuleFileName)

Dear Lispers, I've been writing a small HTTP server and I'd like to deploy it to a friends computer. To allow some configuration to be done per machine, I want to add a settings file (like 'setting.ini' for other applications) to the same directory as the program will be in, so it can read in the se...
by MicroVirus
Sun Apr 08, 2012 11:48 am
Forum: Common Lisp
Topic: Creating a synonymous name for a function
Replies: 3
Views: 5296

Re: Creating a synonymous name for a function

Thanks for the responses. I got a bit confused in all the possibilities, and what I ended up needing was a macrolet, as I also need to pass the parameters directly to the other function (which contains required and keyword parameters): (labels ((cow (some arguments here) "cow")) (macrolet ...